Vincent Povirk : gdiplus: Prevent integer overflows when rounding text bounds.
Alexandre Julliard
julliard at winehq.org
Mon Apr 19 11:51:14 CDT 2010
Module: wine
Branch: master
Commit: 68ce9e925a37eac5c9d972cd29119d39a087d326
URL: http://source.winehq.org/git/wine.git/?a=commit;h=68ce9e925a37eac5c9d972cd29119d39a087d326
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Sat Apr 17 12:04:03 2010 -0500
gdiplus: Prevent integer overflows when rounding text bounds.
Mono calls GdipMeasureString with a height so large that rounding and
converting it to an integer gives a negative result.
---
dlls/gdiplus/graphics.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 7a6fad3..eb24008 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -3493,7 +3493,7 @@ static GpStatus gdip_format_string(GpGraphics *graphics,
gdip_format_string_callback callback, void *user_data)
{
WCHAR* stringdup;
- INT sum = 0, height = 0, fit, fitcpy, i, j, lret, nwidth,
+ int sum = 0, height = 0, fit, fitcpy, i, j, lret, nwidth,
nheight, lineend, lineno = 0;
RectF bounds;
StringAlignment halign;
@@ -3508,8 +3508,8 @@ static GpStatus gdip_format_string(GpGraphics *graphics,
nwidth = roundr(rect->Width);
nheight = roundr(rect->Height);
- if (nwidth == 0) nwidth = INT_MAX;
- if (nheight == 0) nheight = INT_MAX;
+ if (nwidth == 0 || rect->Width >= INT_MAX) nwidth = INT_MAX;
+ if (nheight == 0 || rect->Height >= INT_MAX) nheight = INT_MAX;
for(i = 0, j = 0; i < length; i++){
/* FIXME: This makes the indexes passed to callback inaccurate. */
More information about the wine-cvs
mailing list