From fb4649a3feeb35c66333a4c4f0a8c3f1cbc4a3b2 Mon Sep 17 00:00:00 2001 From: Luis <113704180+LuisR385@users.noreply.github.com> Date: Mon, 13 Jul 2026 22:10:27 +0900 Subject: [PATCH 1/4] [rcore][desktop] Fix clipboard image memory leak (#5968) * [rcore][desktop] Fix clipboard image memory leak * [delete] delete comment GetClipboardImage into NOTE about where put SDL_free() . --- src/platforms/rcore_desktop_sdl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c index f51eedd97..0936dda0e 100644 --- a/src/platforms/rcore_desktop_sdl.c +++ b/src/platforms/rcore_desktop_sdl.c @@ -1255,12 +1255,14 @@ Image GetClipboardImage(void) for (int i = 0; i < SDL_arraysize(imageFormats); i++) { - // NOTE: This pointer should be free with SDL_free() at some point fileData = SDL_GetClipboardData(imageFormats[i], &dataSize); if (fileData) { image = LoadImageFromMemory(imageExtensions[i], fileData, (int)dataSize); + + SDL_free(fileData); + if (IsImageValid(image)) { TRACELOG(LOG_INFO, "Clipboard: Got image from clipboard successfully: %s", imageExtensions[i]); From b631fb3d052b767ccd0281b0d008cdaf810b5267 Mon Sep 17 00:00:00 2001 From: Thiago Mucci Date: Mon, 13 Jul 2026 09:11:42 -0400 Subject: [PATCH 2/4] Fix TextSubtext() returning empty string when position is 0 (#5975) --- src/rtext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rtext.c b/src/rtext.c index 35c6f7307..248857975 100644 --- a/src/rtext.c +++ b/src/rtext.c @@ -1699,7 +1699,7 @@ const char *TextSubtext(const char *text, int position, int length) static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 }; memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH); - if ((text != NULL) && (position > 0) && (length > 0)) + if ((text != NULL) && (position >= 0) && (length > 0)) { int textLength = TextLength(text); 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 3/4] 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); From 7a247ff40fc5e77243b6e0af856437d2e6231c31 Mon Sep 17 00:00:00 2001 From: Thiago Mucci Date: Mon, 13 Jul 2026 13:19:02 -0400 Subject: [PATCH 4/4] Fix swScissor() Y-axis clipping inversion in software renderer (#5976) --- src/external/rlsw.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/external/rlsw.h b/src/external/rlsw.h index bb6e11679..6ca1cecf1 100644 --- a/src/external/rlsw.h +++ b/src/external/rlsw.h @@ -4307,8 +4307,8 @@ void swScissor(int x, int y, int width, int height) RLSW.scClipMin[0] = (2.0f*(float)RLSW.scMin[0]/(float)RLSW.vpSize[0]) - 1.0f; RLSW.scClipMax[0] = (2.0f*(float)RLSW.scMax[0]/(float)RLSW.vpSize[0]) - 1.0f; - RLSW.scClipMax[1] = 1.0f - (2.0f*(float)RLSW.scMin[1]/(float)RLSW.vpSize[1]); - RLSW.scClipMin[1] = 1.0f - (2.0f*(float)RLSW.scMax[1]/(float)RLSW.vpSize[1]); + RLSW.scClipMin[1] = (2.0f*(float)RLSW.scMin[1]/(float)RLSW.vpSize[1]) - 1.0f; + RLSW.scClipMax[1] = (2.0f*(float)RLSW.scMax[1]/(float)RLSW.vpSize[1]) - 1.0f; } void swClearColor(float r, float g, float b, float a)