gdiplus: Check custom dash array for bad properties.
This commit is contained in:
parent
a35206e08e
commit
b6b7e915c3
|
@ -223,9 +223,21 @@ GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* custom
|
|||
GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash,
|
||||
INT count)
|
||||
{
|
||||
INT i;
|
||||
REAL sum = 0;
|
||||
|
||||
if(!pen || !dash)
|
||||
return InvalidParameter;
|
||||
|
||||
for(i = 0; i < count; i++){
|
||||
sum += dash[i];
|
||||
if(dash[i] < 0.0)
|
||||
return InvalidParameter;
|
||||
}
|
||||
|
||||
if(sum == 0.0 && count)
|
||||
return InvalidParameter;
|
||||
|
||||
GdipFree(pen->dashes);
|
||||
pen->dashes = NULL;
|
||||
|
||||
|
|
|
@ -176,12 +176,10 @@ static void test_dasharray(void)
|
|||
|
||||
/* Some invalid array values. */
|
||||
status = GdipSetPenDashArray(pen, &dashes[7], 5);
|
||||
todo_wine
|
||||
expect(InvalidParameter, status);
|
||||
expect(InvalidParameter, status);
|
||||
dashes[9] = -1.0;
|
||||
status = GdipSetPenDashArray(pen, &dashes[7], 5);
|
||||
todo_wine
|
||||
expect(InvalidParameter, status);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
/* Try to set with count = 0. */
|
||||
GdipSetPenDashStyle(pen, DashStyleDot);
|
||||
|
|
Loading…
Reference in New Issue