freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master b44e6c2: [cff] Protect against invalid `vsindex' and


From: Werner LEMBERG
Subject: [freetype2] master b44e6c2: [cff] Protect against invalid `vsindex' and `blend' values.
Date: Thu, 22 Dec 2016 07:30:28 +0000 (UTC)

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

    [cff] Protect against invalid `vsindex' and `blend' values.
    
    Reported as
    
      https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=305
    
    * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdVSINDEX,
    cf2_cmdBLEND>: Implement it.
---
 ChangeLog          |   11 +++++++++++
 src/cff/cf2intrp.c |   17 ++++++++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 861eca9..d5697da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2016-12-22  Werner Lemberg  <address@hidden>
 
+       [cff] Protect against invalid `vsindex' and `blend' values.
+
+       Reported as
+
+         https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=305
+
+       * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdVSINDEX,
+       cf2_cmdBLEND>: Implement it.
+
+2016-12-22  Werner Lemberg  <address@hidden>
+
        [ftfuzzer] Always use Adobe CFF engine.
 
        * src/tools/ftfuzzer/ftfuzzer.cc (FT_Global::FT_Global): Implement
diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c
index 2bbbb33..9c059a1 100644
--- a/src/cff/cf2intrp.c
+++ b/src/cff/cf2intrp.c
@@ -659,7 +659,13 @@
           goto exit;
         }
 
-        font->vsindex = (FT_UInt)cf2_stack_popInt( opStack );
+        {
+          FT_Int  temp = cf2_stack_popInt( opStack );
+
+
+          if ( temp >= 0 )
+            font->vsindex = (FT_UInt)temp;
+        }
         break;
 
       case cf2_cmdBLEND:
@@ -687,7 +693,12 @@
           }
 
           /* do the blend */
-          numBlends = (FT_UInt)cf2_stack_popInt( opStack );
+          {
+            FT_Int  temp = cf2_stack_popInt( opStack );
+
+
+            numBlends = temp > 0 ? (FT_UInt)temp : 0;
+          }
           cf2_doBlend( &font->blend, opStack, numBlends );
 
           font->blend.usedBV = TRUE;
@@ -1225,7 +1236,7 @@
                     idx = cf2_stack_popInt( opStack );
 
                     if ( idx >= 0 && idx < CF2_STORAGE_SIZE )
-                    cf2_stack_pushFixed( opStack, storage[idx] );
+                      cf2_stack_pushFixed( opStack, storage[idx] );
                   }
                   continue; /* do not clear the stack */
 



reply via email to

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