Evan Stade : gdiplus: Check custom dash array for bad properties.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jul 30 16:52:29 CDT 2007
Module: wine
Branch: master
Commit: b6b7e915c30a83cd5a6dce6606d5f149e4ae1de1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b6b7e915c30a83cd5a6dce6606d5f149e4ae1de1
Author: Evan Stade <estade at gmail.com>
Date: Fri Jul 27 16:07:47 2007 -0700
gdiplus: Check custom dash array for bad properties.
---
dlls/gdiplus/pen.c | 12 ++++++++++++
dlls/gdiplus/tests/pen.c | 6 ++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c
index 7d7237b..b85f158 100644
--- a/dlls/gdiplus/pen.c
+++ b/dlls/gdiplus/pen.c
@@ -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;
diff --git a/dlls/gdiplus/tests/pen.c b/dlls/gdiplus/tests/pen.c
index 3fede54..fc792a6 100644
--- a/dlls/gdiplus/tests/pen.c
+++ b/dlls/gdiplus/tests/pen.c
@@ -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);
More information about the wine-cvs
mailing list