freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master f09c5e58c: * src/raster/ftraster.c (Convert_Glyph): F


From: Werner Lemberg
Subject: [freetype2] master f09c5e58c: * src/raster/ftraster.c (Convert_Glyph): Fix null-dereference.
Date: Fri, 13 Oct 2023 09:44:50 -0400 (EDT)

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

    * src/raster/ftraster.c (Convert_Glyph): Fix null-dereference.
---
 src/raster/ftraster.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index 4f70a737a..570d54711 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -1996,16 +1996,18 @@
       if ( Decompose_Curve( RAS_VARS first, last, flipped ) )
         return FAILURE;
 
+      /* Note that ras.gProfile can stay nil if the contour was */
+      /* too small to be drawn or degenerate.                   */
+      if ( !ras.gProfile )
+        continue;
+
       /* we must now check whether the extreme arcs join or not */
       if ( FRAC( ras.lastY ) == 0 &&
            ras.lastY >= ras.minY  &&
            ras.lastY <= ras.maxY  )
-        if ( ras.gProfile                        &&
-             ( ras.gProfile->flags & Flow_Up ) ==
+        if ( ( ras.gProfile->flags & Flow_Up ) ==
                ( ras.cProfile->flags & Flow_Up ) )
           ras.top--;
-        /* Note that ras.gProfile can be nil if the contour was too small */
-        /* to be drawn.                                                   */
 
       lastProfile = ras.cProfile;
       if ( ras.top != ras.cProfile->offset &&
@@ -2017,8 +2019,7 @@
         return FAILURE;
 
       /* close the `next profile in contour' linked list */
-      if ( ras.gProfile )
-        lastProfile->next = ras.gProfile;
+      lastProfile->next = ras.gProfile;
     }
 
     if ( Finalize_Profile_Table( RAS_VAR ) )



reply via email to

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