shithub: freetype+ttf2subf

Download patch

ref: 6305b869d86ff415a33576df6d43729673c66eee
parent: 0ae6cf214ff1eec6499c347726a18b8a9809ab2c
author: Werner Lemberg <[email protected]>
date: Wed Jun 30 14:24:33 EDT 2010

Fix Savannah bug #30263.

* src/smooth/ftgrays.c (gray_render_span): Use cast to `unsigned
int' to avoid integer overflow.

* src/smooth/ftsmooth.c (ft_smooth_render_generic): Use smaller
threshold values for `width' and `height'.  This is not directly
related to the bug fix but makes sense anyway.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-06-30  Werner Lemberg  <[email protected]>
+
+	Fix Savannah bug #30263.
+
+	* src/smooth/ftgrays.c (gray_render_span): Use cast to `unsigned
+	int' to avoid integer overflow.
+
+	* src/smooth/ftsmooth.c (ft_smooth_render_generic): Use smaller
+	threshold values for `width' and `height'.  This is not directly
+	related to the bug fix but makes sense anyway.
+
 2010-06-30  Alexei Podtelezhnikov  <[email protected]>
 
 	Minor optimizations by avoiding divisions.
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1186,7 +1186,7 @@
     /* first of all, compute the scanline offset */
     p = (unsigned char*)map->buffer - y * map->pitch;
     if ( map->pitch >= 0 )
-      p += ( map->rows - 1 ) * map->pitch;
+      p += (unsigned)( ( map->rows - 1 ) * map->pitch );
 
     for ( ; count > 0; count--, spans++ )
     {
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Anti-aliasing renderer interface (body).                             */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009 by             */
+/*  Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -200,7 +200,7 @@
 
     /* Required check is ( pitch * height < FT_ULONG_MAX ),     */
     /* but we care realistic cases only. Always pitch <= width. */
-    if ( width > 0xFFFFU || height > 0xFFFFU )
+    if ( width > 0x7FFFU || height > 0x7FFFU )
     {
       FT_ERROR(( "ft_smooth_render_generic: glyph too large: %d x %d\n",
                  width, height ));