Skip to content

Commit

Permalink
Fix bounds check for ImageDrawRectangleRec (#3732)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blockguy24 authored Jan 14, 2024
1 parent 0213309 commit d2b1256
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rtextures.c
Original file line number Diff line number Diff line change
Expand Up @@ -3586,8 +3586,8 @@ void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color)
if ((rec.y + rec.height) >= dst->height) rec.height = dst->height - rec.y;

// Check if the rect is even inside the image
if ((rec.x > dst->width) || (rec.y > dst->height)) return;
if (((rec.x + rec.width) < 0) || (rec.y + rec.height < 0)) return;
if ((rec.x >= dst->width) || (rec.y >= dst->height)) return;
if (((rec.x + rec.width) <= 0) || (rec.y + rec.height <= 0)) return;

int sy = (int)rec.y;
int sx = (int)rec.x;
Expand Down

0 comments on commit d2b1256

Please sign in to comment.