freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 3ed3a96: [cff] Integer overflows.


From: Werner LEMBERG
Subject: [freetype2] master 3ed3a96: [cff] Integer overflows.
Date: Sun, 11 Jun 2017 07:51:08 -0400 (EDT)

branch: master
commit 3ed3a96181625286f5899118f884fb4b125ebda2
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [cff] Integer overflows.
    
    Reported as
    
      https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2200
      https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2210
    
    * src/cff/cf2hints.c (cf2_hintmap_insertHint): Use SUB_INT32 and
    ADD_INT32.
    
    * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdVMOVETO>: Use
    ADD_INT32.
---
 ChangeLog          | 15 +++++++++++++++
 src/cff/cf2hints.c |  6 +++---
 src/cff/cf2intrp.c |  3 ++-
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e6441ff..ef88237 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2017-06-11  Werner Lemberg  <address@hidden>
+
+       [cff] Integer overflows.
+
+       Reported as
+
+         https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2200
+         https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2210
+
+       * src/cff/cf2hints.c (cf2_hintmap_insertHint): Use SUB_INT32 and
+       ADD_INT32.
+
+       * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdVMOVETO>: Use
+       ADD_INT32.
+
 2017-06-10  Werner Lemberg  <address@hidden>
 
        [truetype] Fix TT_Set_Var_Design.
diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c
index 9643bd4..0951e1e 100644
--- a/src/cff/cf2hints.c
+++ b/src/cff/cf2hints.c
@@ -651,8 +651,8 @@
                                 hintmap->scale );
 
 
-        firstHintEdge->dsCoord  = midpoint - halfWidth;
-        secondHintEdge->dsCoord = midpoint + halfWidth;
+        firstHintEdge->dsCoord  = SUB_INT32( midpoint, halfWidth );
+        secondHintEdge->dsCoord = ADD_INT32( midpoint, halfWidth );
       }
       else
         firstHintEdge->dsCoord = cf2_hintmap_map( hintmap->initialHintMap,
@@ -721,7 +721,7 @@
 
       /* insert first edge */
       hintmap->edge[indexInsert] = *firstHintEdge;         /* copy struct */
-      hintmap->count += 1;
+      hintmap->count            += 1;
 
       if ( isPair )
       {
diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c
index a43d33e..a816280 100644
--- a/src/cff/cf2intrp.c
+++ b/src/cff/cf2intrp.c
@@ -768,7 +768,8 @@
         FT_TRACE4(( " vmoveto\n" ));
 
         if ( cf2_stack_count( opStack ) > 1 && !haveWidth )
-          *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
+          *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
+                              nominalWidthX );
 
         /* width is defined or default after this */
         haveWidth = TRUE;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]