freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 0313a11 2/3: * src/cid/cidgload.c (cid_load_glyph): F


From: Werner Lemberg
Subject: [freetype2] master 0313a11 2/3: * src/cid/cidgload.c (cid_load_glyph): Fortify incremental loading.
Date: Thu, 7 Oct 2021 22:46:53 -0400 (EDT)

branch: master
commit 0313a11c4c2d1a6688facccffd18e0473dc6953e
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    * src/cid/cidgload.c (cid_load_glyph): Fortify incremental loading.
---
 src/cid/cidgload.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index e3e6832..bf78957 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -76,20 +76,17 @@
 
       error = inc->funcs->get_glyph_data( inc->object,
                                           glyph_index, &glyph_data );
-      if ( error )
+      if ( error || glyph_data.length < cid->fd_bytes )
         goto Exit;
 
       p         = (FT_Byte*)glyph_data.pointer;
       fd_select = cid_get_offset( &p, cid->fd_bytes );
 
-      if ( glyph_data.length != 0 )
-      {
-        glyph_length = glyph_data.length - cid->fd_bytes;
+      glyph_length = glyph_data.length - cid->fd_bytes;
 
-        if ( !FT_QALLOC( charstring, glyph_length ) )
-          FT_MEM_COPY( charstring, glyph_data.pointer + cid->fd_bytes,
-                       glyph_length );
-      }
+      if ( !FT_QALLOC( charstring, glyph_length ) )
+        FT_MEM_COPY( charstring, glyph_data.pointer + cid->fd_bytes,
+                     glyph_length );
 
       inc->funcs->free_glyph_data( inc->object, &glyph_data );
 



reply via email to

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