Commit eb22ef26d94a8bebb2cfd68306c6ba4ee679517e

Werner Lemberg 2015-08-04T06:50:04

Another left-shift bug (#45681). * src/base/ftobjs.c (IsMacBinary): Only accept positive values for `dlen'.

diff --git a/ChangeLog b/ChangeLog
index b78fcbe..c8ddab7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-08-04  Werner Lemberg  <wl@gnu.org>
+
+	Another left-shift bug (#45681).
+
+	* src/base/ftobjs.c (IsMacBinary): Only accept positive values for
+	`dlen'.
+
 2015-08-03  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
 	[base] Fix `ft_corner_orientation'.
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 9c3332c..4fa0593 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1889,13 +1889,14 @@
     if ( error )
       goto Exit;
 
-    if (            header[ 0] !=  0 ||
-                    header[74] !=  0 ||
-                    header[82] !=  0 ||
-                    header[ 1] ==  0 ||
-                    header[ 1] >  33 ||
-                    header[63] !=  0 ||
-         header[2 + header[1]] !=  0 )
+    if (            header[ 0] !=   0 ||
+                    header[74] !=   0 ||
+                    header[82] !=   0 ||
+                    header[ 1] ==   0 ||
+                    header[ 1] >   33 ||
+                    header[63] !=   0 ||
+         header[2 + header[1]] !=   0 ||
+                  header[0x53] > 0x7F )
       return FT_THROW( Unknown_File_Format );
 
     dlen = ( header[0x53] << 24 ) |