mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
sw_engine: Fix buffer overflow in texture mapping rasterizer
Fix heap buffer overflow in texture mapping rasterizer by adding proper bounds checking for texture coordinates. This prevents accessing memory outside of the allocated image buffer during texture sampling and interpolation.
This commit is contained in:
parent
3d6fe5ffae
commit
50a0df805f
1 changed files with 2 additions and 2 deletions
|
@ -336,9 +336,9 @@ static void _rasterPolygonImageSegment(SwSurface* surface, const SwImage* image,
|
|||
//Draw horizontal line
|
||||
while (x++ < x2) {
|
||||
uu = (int) u;
|
||||
if (uu >= sw) continue;
|
||||
if (uu < 0 || uu >= sw) continue;
|
||||
vv = (int) v;
|
||||
if (vv >= sh) continue;
|
||||
if (vv < 0 || vv >= sh) continue;
|
||||
|
||||
ar = (int)(255.0f * (1.0f - modff(u, &iptr)));
|
||||
ab = (int)(255.0f * (1.0f - modff(v, &iptr)));
|
||||
|
|
Loading…
Add table
Reference in a new issue