From 48719759e834522753e224cff8c0bb517fbc3cde Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Tue, 14 Mar 2023 23:39:48 +0900 Subject: [PATCH] sw_engine - ++safety Prevent any potential crash. @Issues: https://github.com/thorvg/thorvg/issues/1327 Change-Id: I57e6582f17a3beae475d85261439aa78ca5f6919 --- src/lib/sw_engine/tvgSwRasterTexmap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/sw_engine/tvgSwRasterTexmap.h b/src/lib/sw_engine/tvgSwRasterTexmap.h index 58906b6..40d4037 100644 --- a/src/lib/sw_engine/tvgSwRasterTexmap.h +++ b/src/lib/sw_engine/tvgSwRasterTexmap.h @@ -548,7 +548,7 @@ static bool _apply(SwSurface* surface, AASpans* aaSpans) static bool _rasterTexmapPolygon(SwSurface* surface, const SwImage* image, const Matrix* transform, const SwBBox* region, uint32_t opacity, uint32_t (*blendMethod)(uint32_t)) { //Exceptions: No dedicated drawing area? - if (!region && image->rle->size == 0) return false; + if (!image->rle || (!region && image->rle->size == 0)) return false; /* Prepare vertices. shift XY coordinates to match the sub-pixeling technique. */ @@ -605,7 +605,7 @@ static bool _rasterTexmapPolygon(SwSurface* surface, const SwImage* image, const static bool _rasterTexmapPolygonMesh(SwSurface* surface, const SwImage* image, const Polygon* triangles, const uint32_t triangleCount, const Matrix* transform, const SwBBox* region, uint32_t opacity, uint32_t (*blendMethod)(uint32_t)) { //Exceptions: No dedicated drawing area? - if (!region && image->rle->size == 0) return false; + if (!image->rle || (!region && image->rle->size == 0)) return false; // Step polygons once to transform auto transformedTris = (Polygon*)malloc(sizeof(Polygon) * triangleCount); -- 2.7.4