sw_engine: fix TexmapPolygon rastering

The y range initialization was missing a check to ensure
that the height is a positive value. This could lead to
an attempt to call malloc with a negative argument, which
cast to an unsigned value, caused a crash.
This commit is contained in:
Mira Grudzinska 2024-08-21 02:29:53 +02:00 committed by Hermet Park
parent f5337015e9
commit a08c73b08b

View file

@ -53,12 +53,10 @@ static bool _arrange(const SwImage* image, const SwBBox* region, int& yStart, in
regionBottom = image->rle->spans[image->rle->size - 1].y;
}
if (yStart >= regionBottom) return false;
if (yStart < regionTop) yStart = regionTop;
if (yEnd > regionBottom) yEnd = regionBottom;
return true;
return yEnd > yStart;
}