Commit b460a50610320c425292518cb5f6341af234e2f9

Werner Lemberg 2021-06-19T07:03:40

[truetype] Fix integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=35312 * src/truetype/ttinterp.c (Ins_JMPR): Use `ADD_LONG`.

diff --git a/ChangeLog b/ChangeLog
index 522d084..aaec6b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2021-06-19  Werner Lemberg  <david@freetype.org>
 
+	[truetype] Fix integer overflow.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=35312
+
+	* src/truetype/ttinterp.c (Ins_JMPR): Use `ADD_LONG`.
+
+2021-06-19  Werner Lemberg  <david@freetype.org>
+
 	[autofit] Prevent hinting if there are too many segments.
 
 	This speeds up handling of broken glyphs.
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 6747f94..96b48a0 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -3593,7 +3593,7 @@
       return;
     }
 
-    exc->IP += args[0];
+    exc->IP = ADD_LONG( exc->IP, args[0] );
     if ( exc->IP < 0                                             ||
          ( exc->callTop > 0                                    &&
            exc->IP > exc->callStack[exc->callTop - 1].Def->end ) )