[PATCH] gdiplus: Each pen dash array element must be greater than zero.
Jeff Smith
whydoubt at gmail.com
Fri Feb 14 00:20:29 CST 2020
Signed-off-by: Jeff Smith <whydoubt at gmail.com>
---
dlls/gdiplus/pen.c | 5 +----
dlls/gdiplus/tests/pen.c | 3 +++
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c
index 8bcb91819a..156f90a19d 100644
--- a/dlls/gdiplus/pen.c
+++ b/dlls/gdiplus/pen.c
@@ -598,13 +598,10 @@ GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash,
for(i = 0; i < count; i++){
sum += dash[i];
- if(dash[i] < 0.0)
+ if(dash[i] <= 0.0)
return InvalidParameter;
}
- if(sum == 0.0 && count)
- return InvalidParameter;
-
heap_free(pen->dashes);
pen->dashes = NULL;
diff --git a/dlls/gdiplus/tests/pen.c b/dlls/gdiplus/tests/pen.c
index ceab92acff..3c4507f9d5 100644
--- a/dlls/gdiplus/tests/pen.c
+++ b/dlls/gdiplus/tests/pen.c
@@ -222,6 +222,9 @@ static void test_dasharray(void)
dashes[9] = -1.0;
status = GdipSetPenDashArray(pen, &dashes[7], 5);
expect(InvalidParameter, status);
+ dashes[9] = 1.0;
+ status = GdipSetPenDashArray(pen, &dashes[7], 5);
+ expect(InvalidParameter, status);
/* Try to set with count = 0. */
GdipSetPenDashStyle(pen, DashStyleDot);
--
2.23.0
More information about the wine-devel
mailing list