Huw Davies : gdi32: Avoid reading past the end of the indices array.

Alexandre Julliard julliard at winehq.org
Thu Nov 24 15:04:38 CST 2011


Module: wine
Branch: master
Commit: 0ab46cd5e98e4d588e16425d55165e9c4475190b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0ab46cd5e98e4d588e16425d55165e9c4475190b

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Nov 24 09:26:45 2011 +0000

gdi32: Avoid reading past the end of the indices array.

Spotted by Marcus Meissner.

---

 dlls/gdi32/dibdrv/graphics.c |    3 ++-
 dlls/gdi32/font.c            |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c
index 590a816..d0c0afe 100644
--- a/dlls/gdi32/dibdrv/graphics.c
+++ b/dlls/gdi32/dibdrv/graphics.c
@@ -192,8 +192,9 @@ static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT aa_flags, GLYPHMETRICS
 
     indices[0] = index;
 
-    for (i = 0; i < sizeof(indices) / sizeof(indices[0]); index = indices[++i])
+    for (i = 0; i < sizeof(indices) / sizeof(indices[0]); i++)
     {
+        index = indices[i];
         ret = GetGlyphOutlineW( hdc, index, ggo_flags, metrics, 0, NULL, &identity );
         if (ret != GDI_ERROR) break;
     }
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 0f01a92..5b7d500 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -1640,8 +1640,9 @@ static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT aa_flags,
 
     indices[0] = index;
 
-    for (i = 0; i < sizeof(indices) / sizeof(indices[0]); index = indices[++i])
+    for (i = 0; i < sizeof(indices) / sizeof(indices[0]); i++)
     {
+        index = indices[i];
         ret = GetGlyphOutlineW( hdc, index, ggo_flags, metrics, 0, NULL, &identity );
         if (ret != GDI_ERROR) break;
     }




More information about the wine-cvs mailing list