freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 8ed5a24: [cff, cid] Fix segfaults in case of error (#


From: Werner LEMBERG
Subject: [freetype2] master 8ed5a24: [cff, cid] Fix segfaults in case of error (#58621).
Date: Fri, 19 Jun 2020 04:38:52 -0400 (EDT)

branch: master
commit 8ed5a2477eecf27e645bbb568b66a37eea12973c
Author: Sebastian Rasmussen <sebras@gmail.com>
Commit: Werner Lemberg <wl@gnu.org>

    [cff, cid] Fix segfaults in case of error (#58621).
    
    * src/cff/cffobjs.c (cff_slot_done), src/cid/cidobjs.c
    (cid_slot_done): If `ft_glyphslot_init' fails to allocate
    `internal', then the class' `done_slot' callback (called by
    `ft_glyphslot_done') must not dereference the pointer to `internal'.
---
 ChangeLog         | 9 +++++++++
 src/cff/cffobjs.c | 3 ++-
 src/cid/cidobjs.c | 3 ++-
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c7c9364..90aa43b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-06-19  Sebastian Rasmussen  <sebras@gmail.com>
+
+       [cff, cid] Fix segfaults in case of error (#58621).
+
+       * src/cff/cffobjs.c (cff_slot_done), src/cid/cidobjs.c
+       (cid_slot_done): If `ft_glyphslot_init' fails to allocate
+       `internal', then the class' `done_slot' callback (called by
+       `ft_glyphslot_done') must not dereference the pointer to `internal'.
+
 2020-06-19  Werner Lemberg  <wl@gnu.org>
 
        [base] Fix UBSAN error.
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 252f58a..aa959ed 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -352,7 +352,8 @@
   FT_LOCAL_DEF( void )
   cff_slot_done( FT_GlyphSlot  slot )
   {
-    slot->internal->glyph_hints = NULL;
+    if ( slot->internal )
+      slot->internal->glyph_hints = NULL;
   }
 
 
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index 2d284ca..04b295e 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -49,7 +49,8 @@
   FT_LOCAL_DEF( void )
   cid_slot_done( FT_GlyphSlot  slot )
   {
-    slot->internal->glyph_hints = NULL;
+    if ( slot->internal )
+      slot->internal->glyph_hints = NULL;
   }
 
 



reply via email to

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