shithub: freetype+ttf2subf

Download patch

ref: da5946278048ca97594120b23b47adb43095503b
parent: 8ad243bdcd033cc2cb17f3c11b49e89ecee9ba30
author: suzuki toshiya <[email protected]>
date: Thu Jul 9 13:21:32 EDT 2009

smooth: Check glyph size by width/height, instead of pitch/height.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2009-07-09  suzuki toshiya  <[email protected]>
 
+	smooth: Check glyph size by width/height, instead of pitch/height.
+	Suggested by der Mouse <[email protected]>.
+
+	* src/smooth/ftsmooth.c (ft_smooth_render_generic): Improve
+	the check for too large glyph. Replace the pair of `pitch' and
+	`height' by the pair of `width' and `height'. `pitch' cannot
+	be greater than `height'. The required is checking the product
+	`pitch' * `height' <= FT_ULONG_MAX, but we use cheap checks for 
+	the realistic case only.
+
+2009-07-09  suzuki toshiya  <[email protected]>
+
 	Register 2 missing trace components, t1afm and ttbdf.
 
 	* include/freetype/internal/fttrace.h: Add FT_TRACE_DEF( t1afm )
@@ -957,7 +969,7 @@
 	Problem reported by Tavis Ormandy <[email protected]>.
 
 	* src/smooth/ftsmooth.c (ft_smooth_render_generic): Don't allow
-	`width' or `pitch' to be larger than 0xFFFF.
+	`pitch' or `height' to be larger than 0xFFFF.
 
 2009-03-20  Werner Lemberg  <[email protected]>
 	    Tavis Ormandy <[email protected]>
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -196,7 +196,9 @@
 
 #endif
 
-    if ( pitch > 0xFFFF || height > 0xFFFF )
+    /* Required check is ( pitch * height < FT_ULONG_MAX ),     */
+    /* but we care realistic cases only. Always pitch <= width. */
+    if ( width > 0xFFFFU || height > 0xFFFFU )
     {
       FT_ERROR(( "ft_smooth_render_generic: glyph too large: %d x %d\n",
                  width, height ));