From d2b1256e5c3567484486ad70cc2bb69495abfbf4 Mon Sep 17 00:00:00 2001 From: Blockguy24 <21016331+Blockguy24@users.noreply.github.com> Date: Sun, 14 Jan 2024 21:21:29 +1100 Subject: [PATCH] Fix bounds check for `ImageDrawRectangleRec` (#3732) --- src/rtextures.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rtextures.c b/src/rtextures.c index cdec7a3a45d2..fb7261378001 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -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;