Commit 82365c0dead99dd119d9e7117cf4f36ce1d1cbe1

Werner Lemberg 2012-02-25T13:22:40

[type42] Fix Savannah bug #35602. * src/type42/t42parse.c (t42_parse_sfnts): Check `string_size' more thoroughly.

diff --git a/ChangeLog b/ChangeLog
index 98df508..5bca087 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2012-02-25  Werner Lemberg  <wl@gnu.org>
 
+	[type42] Fix Savannah bug #35602.
+
+	* src/type42/t42parse.c (t42_parse_sfnts): Check `string_size' more
+	thoroughly.
+
+2012-02-25  Werner Lemberg  <wl@gnu.org>
+
 	[bdf] Fix Savannah bugs #35599 and #35600.
 
 	* src/bdf/bdflib.c (ACMSG16): New warning message.
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
index 976aa22..f2408cd 100644
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 42 font parser (body).                                          */
 /*                                                                         */
-/*  Copyright 2002-2011 by                                                 */
+/*  Copyright 2002-2012 by                                                 */
 /*  Roberto Alameda.                                                       */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -608,7 +608,8 @@
       }
 
       /* A string can have a trailing zero byte for padding.  Ignore it. */
-      if ( string_buf[string_size - 1] == 0 && ( string_size % 2 == 1 ) )
+      if ( string_size                                                  &&
+           string_buf[string_size - 1] == 0 && ( string_size % 2 == 1 ) )
         string_size--;
 
       if ( !string_size )