From f09c5e58c24b06b71e964d13c39beb86bc19231f Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 13 Oct 2023 13:44:39 +0000 Subject: [PATCH] * 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 ) )