Commit 8d6025c8da3704fe4a68860f753ce33b67014a84

Brian Nixon 2013-05-13T09:06:42

Fix Savannah bug #38970. * src/base/ftdebug.c, builds/win32/ftdebug.c, builds/wince/ftdebug.c, builds/amiga/src/base/ftdebug.c (ft_debug_init): Don't read past the environment variable FT2_DEBUG.

diff --git a/ChangeLog b/ChangeLog
index 050408d..e1b5c91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-05-13  Brian Nixon  <bnixon@yahoo.com>
+
+	Fix Savannah bug #38970.
+
+	* src/base/ftdebug.c, builds/win32/ftdebug.c,
+	builds/wince/ftdebug.c, builds/amiga/src/base/ftdebug.c
+	(ft_debug_init): Don't read past the environment variable FT2_DEBUG.
+
 2013-05-12  Werner Lemberg  <wl@gnu.org>
 
 	[truetype] Add framework for TrueType properties.
diff --git a/builds/amiga/src/base/ftdebug.c b/builds/amiga/src/base/ftdebug.c
index d3c5ead..4e13a6a 100644
--- a/builds/amiga/src/base/ftdebug.c
+++ b/builds/amiga/src/base/ftdebug.c
@@ -208,6 +208,9 @@
         while ( *p && *p != ':' )
           p++;
 
+        if ( !*p )
+          break;
+
         if ( *p == ':' && p > q )
         {
           FT_Int  n, i, len = (FT_Int)( p - q );
@@ -236,7 +239,7 @@
           p++;
           if ( *p )
           {
-            level = *p++ - '0';
+            level = *p - '0';
             if ( level < 0 || level > 7 )
               level = -1;
           }
diff --git a/builds/win32/ftdebug.c b/builds/win32/ftdebug.c
index baf1d4a..832eb0f 100644
--- a/builds/win32/ftdebug.c
+++ b/builds/win32/ftdebug.c
@@ -166,6 +166,9 @@
         while ( *p && *p != ':' )
           p++;
 
+        if ( !*p )
+          break;
+
         if ( *p == ':' && p > q )
         {
           int  n, i, len = p - q;
@@ -194,7 +197,7 @@
           p++;
           if ( *p )
           {
-            level = *p++ - '0';
+            level = *p - '0';
             if ( level < 0 || level > 7 )
               level = -1;
           }
diff --git a/builds/wince/ftdebug.c b/builds/wince/ftdebug.c
index cd105dc..3c8d328 100644
--- a/builds/wince/ftdebug.c
+++ b/builds/wince/ftdebug.c
@@ -184,6 +184,9 @@
         while ( *p && *p != ':' )
           p++;
 
+        if ( !*p )
+          break;
+
         if ( *p == ':' && p > q )
         {
           int  n, i, len = p - q;
@@ -212,7 +215,7 @@
           p++;
           if ( *p )
           {
-            level = *p++ - '0';
+            level = *p - '0';
             if ( level < 0 || level > 7 )
               level = -1;
           }
diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c
index 67735fc..b9156d1 100644
--- a/src/base/ftdebug.c
+++ b/src/base/ftdebug.c
@@ -181,6 +181,9 @@
         while ( *p && *p != ':' )
           p++;
 
+        if ( !*p )
+          break;
+
         if ( *p == ':' && p > q )
         {
           FT_Int  n, i, len = (FT_Int)( p - q );
@@ -209,7 +212,7 @@
           p++;
           if ( *p )
           {
-            level = *p++ - '0';
+            level = *p - '0';
             if ( level < 0 || level > 7 )
               level = -1;
           }