From 5de8c3521fc909e7f1baa5573329dfe7019e6ab7 Mon Sep 17 00:00:00 2001 From: Commmand_Prompt <62493399+CommandPrompt-Wang@users.noreply.github.com> Date: Mon, 13 Jul 2026 21:13:12 +0800 Subject: [PATCH] fix: ImageFromImage rectangle validation use >= and <= (#5979) --- src/rtextures.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rtextures.c b/src/rtextures.c index b33ab5c50..850161548 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -1231,9 +1231,9 @@ Image ImageFromImage(Image image, Rectangle rec) Image result = { 0 }; // Basic rectangle validation: size smaller than image size - if ((rec.x > 0) && (rec.y > 0) && (rec.width > 0) && (rec.height > 0) && - (((int)rec.x + (int)rec.width) < image.width) && - (((int)rec.y + (int)rec.height) < image.height)) + if ((rec.x >= 0) && (rec.y >= 0) && (rec.width > 0) && (rec.height > 0) && + (((int)rec.x + (int)rec.width) <= image.width) && + (((int)rec.y + (int)rec.height) <= image.height)) { int bytesPerPixel = GetPixelDataSize(1, 1, image.format);