Commit b6b7e915 authored by Evan Stade's avatar Evan Stade Committed by Alexandre Julliard

gdiplus: Check custom dash array for bad properties.

parent a35206e0
......@@ -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,11 +176,9 @@ static void test_dasharray(void)
/* Some invalid array values. */
status = GdipSetPenDashArray(pen, &dashes[7], 5);
todo_wine
expect(InvalidParameter, status);
dashes[9] = -1.0;
status = GdipSetPenDashArray(pen, &dashes[7], 5);
todo_wine
expect(InvalidParameter, status);
/* Try to set with count = 0. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment