Commit fcbc82e69e7b114b0db75e955896107d611898e6

Werner Lemberg 2012-02-26T20:54:19

[smooth] Fix Savannah bug #35604. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Use `FT_Pos' instead of `FT_UInt' for some variables and update comparisons accordingly. A detailed analysis can be found in the bug report.

diff --git a/ChangeLog b/ChangeLog
index f71cab3..207e120 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-02-26  Mateusz Jurczyk  <mjurczyk@google.com>
+	    Werner Lemberg  <wl@gnu.org>
+
+	[smooth] Fix Savannah bug #35604.
+
+	* src/smooth/ftsmooth.c (ft_smooth_render_generic): Use `FT_Pos'
+	instead of `FT_UInt' for some variables and update comparisons
+	accordingly.  A detailed analysis can be found in the bug report.
+
 2012-02-26  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
 	[type42] Minor code optimization.
diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
index 7d35cf2..00499cc 100644
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Anti-aliasing renderer interface (body).                             */
 /*                                                                         */
-/*  Copyright 2000-2006, 2009-2011 by                                      */
+/*  Copyright 2000-2006, 2009-2012 by                                      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -105,9 +105,9 @@
     FT_Error     error;
     FT_Outline*  outline = NULL;
     FT_BBox      cbox;
-    FT_UInt      width, height, pitch;
+    FT_Pos       width, height, pitch;
 #ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-    FT_UInt      height_org, width_org;
+    FT_Pos       height_org, width_org;
 #endif
     FT_Bitmap*   bitmap;
     FT_Memory    memory;
@@ -151,7 +151,7 @@
       return Smooth_Err_Raster_Overflow;
     }
     else
-      width  = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
+      width  = ( cbox.xMax - cbox.xMin ) >> 6;
 
     if ( cbox.yMin < 0 && cbox.yMax > FT_INT_MAX + cbox.yMin )
     {
@@ -161,7 +161,7 @@
       return Smooth_Err_Raster_Overflow;
     }
     else
-      height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
+      height = ( cbox.yMax - cbox.yMin ) >> 6;
 
     bitmap = &slot->bitmap;
     memory = render->root.memory;
@@ -223,7 +223,7 @@
 
     /* Required check is ( pitch * height < FT_ULONG_MAX ),     */
     /* but we care realistic cases only. Always pitch <= width. */
-    if ( width > 0x7FFFU || height > 0x7FFFU )
+    if ( width > 0x7FFF || height > 0x7FFF )
     {
       FT_ERROR(( "ft_smooth_render_generic: glyph too large: %u x %u\n",
                  width, height ));