Check that number of points passed to wxDC::DrawSpline() is at least 2

DoDrawSpline() implementations for all ports work for the number of points
>= 2 (for 2 points there is drawn a straight line) so we need to add checks
whether this requirement is met.

See #19172.
This commit is contained in:
Artur Wieczorek
2021-06-30 22:20:39 +02:00
parent a3988c8db6
commit b35d595e5d
6 changed files with 12 additions and 11 deletions

View File

@@ -903,16 +903,14 @@ static void wx_spline_draw_point_array(wxDC *dc)
void wxDCImpl::DoDrawSpline( const wxPointList *points )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
wxCHECK_RET(points, "NULL pointer to spline points?");
wxCHECK_RET(points->GetCount() >= 2, "incomplete list of spline points?");
const wxPoint *p;
double cx1, cy1, cx2, cy2;
double x1, y1, x2, y2;
wxPointList::compatibility_iterator node = points->GetFirst();
if (!node)
// empty list
return;
p = node->GetData();
x1 = p->x;