freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 77c1b33 29/43: Extend Adobe interpreter (pop).


From: Werner LEMBERG
Subject: [freetype2] master 77c1b33 29/43: Extend Adobe interpreter (pop).
Date: Mon, 25 Sep 2017 03:29:28 -0400 (EDT)

branch: master
commit 77c1b331f6cc22a67a4563ebd17bcddc08409a49
Author: Ewald Hew <address@hidden>
Commit: Werner Lemberg <address@hidden>

    Extend Adobe interpreter (pop).
    
    * src/psaux/psintrp.c (cf2_interpT2CharString): Change how unhandled
    OtherSubr results are stored.  Implement the PostScript stack using
    an array.
    <cf2_escPOP>: Ensure that the stack is not cleared after getting
    `OtherSubr' results.
    Fix stack access.
---
 ChangeLog           | 11 +++++++++++
 src/psaux/psintrp.c | 24 ++++++++++++++----------
 2 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1e9c972..5586773 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2017-09-25  Ewald Hew  <address@hidden>
 
+       [psaux] Extend Adobe interpreter (pop).
+
+       * src/psaux/psintrp.c (cf2_interpT2CharString): Change how unhandled
+       OtherSubr results are stored.  Implement the PostScript stack using
+       an array.
+       <cf2_escPOP>: Ensure that the stack is not cleared after getting
+       `OtherSubr' results.
+       Fix stack access.
+
+2017-09-25  Ewald Hew  <address@hidden>
+
        [psaux] Extend Adobe interpreter (callsubr).
 
        * src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_cmdCALLSUBR>:
diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c
index 7ee3a25..12de2cb 100644
--- a/src/psaux/psintrp.c
+++ b/src/psaux/psintrp.c
@@ -490,8 +490,10 @@
 
     /* Stuff for Type 1 */
     FT_Int     known_othersubr_result_cnt   = 0;
-    FT_Int     unknown_othersubr_result_cnt = 0;
     FT_Bool    large_int = FALSE;
+#define PS_STORAGE_SIZE 3
+    CF2_F16Dot16  results[PS_STORAGE_SIZE];   /* for othersubr results */
+    FT_Int        result_cnt = 0;
 
     /* save this for hinting seac accents */
     CF2_Fixed  hintOriginY = curY;
@@ -523,6 +525,7 @@
 
 
     FT_ZERO( &storage );
+    FT_ZERO( &results );
 
     /* initialize the remaining objects */
     cf2_arrstack_init( &subrStack,
@@ -618,7 +621,7 @@
       if ( font->isT1 )
       {
         FT_ASSERT( known_othersubr_result_cnt == 0   ||
-                   unknown_othersubr_result_cnt == 0 );
+                   result_cnt == 0 );
       }
 
       if ( cf2_buf_isEnd( charstring ) )
@@ -644,14 +647,14 @@
 
       if ( font->isT1 )
       {
-        if ( unknown_othersubr_result_cnt > 0 &&
+        if ( result_cnt > 0 &&
              !( op1 == cf2_cmdCALLSUBR ||
                 op1 == cf2_cmdRETURN   ||
                 op1 == cf2_escPOP      ||
                 op1 >= 32 /* Numbers */ ) )
         {
           /* all operands have been transferred by previous pops */
-          unknown_othersubr_result_cnt = 0;
+          result_cnt = 0;
         }
 
         if ( large_int && !( op1 >= 32 || op1 == cf2_escDIV ) )
@@ -1459,20 +1462,21 @@
                     {
                       known_othersubr_result_cnt--;
                       /* ignore, we pushed the operands ourselves */
-                      break;
+                      continue;
                     }
 
-                    if ( unknown_othersubr_result_cnt == 0 )
+                    if ( result_cnt == 0 )
                     {
                       FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
                                  " no more operands for othersubr\n" ));
-                      goto Syntax_Error;
+                      lastError = FT_THROW( Invalid_Glyph_Format );
+                      goto exit;
                     }
 
-                    unknown_othersubr_result_cnt--;
-                    top++;   /* `push' the operand to callothersubr onto the 
stack */
+                    result_cnt--;
+                    cf2_stack_pushFixed( opStack, results[result_cnt] );
                   }
-                  break;
+                  continue; /* do not clear the stack */
 
                 case cf2_escDROP:
                   FT_TRACE4(( " drop\n" ));



reply via email to

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