Commit aba2be820ccaacbd4b9566a31b25740bd7521cec

Ozkan Sezer 2023-07-10T00:15:56

SDL_RWFromMem, SDL_RWFromConstMem: reject negative size parameters. (cherry picked from commit 0ad822eb700e64f219c1a681da2f2d0ea4c64a93)

diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c
index 87307ab..2f66dcf 100644
--- a/src/file/SDL_rwops.c
+++ b/src/file/SDL_rwops.c
@@ -648,7 +648,7 @@ SDL_RWops *SDL_RWFromMem(void *mem, int size)
         SDL_InvalidParamError("mem");
         return rwops;
     }
-    if (!size) {
+    if (size <= 0) {
         SDL_InvalidParamError("size");
         return rwops;
     }
@@ -675,7 +675,7 @@ SDL_RWops *SDL_RWFromConstMem(const void *mem, int size)
         SDL_InvalidParamError("mem");
         return rwops;
     }
-    if (!size) {
+    if (size <= 0) {
         SDL_InvalidParamError("size");
         return rwops;
     }