Commit c4cad30ed1b1f554aa41a98b0b0fdca6e579e22f

Werner Lemberg 2012-03-08T20:11:37

[bdf] Add missing overflow check. * src/bdf/bdflib.c (_bdf_parse_glyphs) <BITMAP>: Add threshold for `glyph->bpr'.

diff --git a/ChangeLog b/ChangeLog
index 5530179..8ce27c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-03-08  Werner Lemberg  <wl@gnu.org>
+
+	[bdf] Add missing overflow check.
+
+	* src/bdf/bdflib.c (_bdf_parse_glyphs) <BITMAP>: Add threshold for
+	`glyph->bpr'.
+
 2012-03-07  Vinnie Falco  <vinnie.falco@gmail.com>
 
 	Prepare source code for amalgamation.
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index 6a66d1d..b7b6857 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -1912,7 +1912,7 @@
       glyph->bpr = ( glyph->bbx.width * p->font->bpp + 7 ) >> 3;
 
       bitmap_size = glyph->bpr * glyph->bbx.height;
-      if ( bitmap_size > 0xFFFFU )
+      if ( glyph->bpr > 0xFFFFU || bitmap_size > 0xFFFFU )
       {
         FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG4, lineno ));
         error = BDF_Err_Bbx_Too_Big;