Bläddra i källkod

Added surface validation to SDL_ConvertSurfaceRect()

Fixes https://github.com/libsdl-org/SDL/issues/15141
Sam Lantinga 3 dagar sedan
förälder
incheckning
2d9fca46c6
1 ändrade filer med 5 tillägg och 0 borttagningar
  1. 5 0
      src/video/SDL_surface.c

+ 5 - 0
src/video/SDL_surface.c

@@ -2311,6 +2311,11 @@ error:
 
 SDL_Surface *SDL_ConvertSurfaceRect(SDL_Surface *surface, const SDL_Rect *rect, SDL_PixelFormat format)
 {
+    CHECK_PARAM(!SDL_SurfaceValid(surface)) {
+        SDL_InvalidParamError("surface");
+        return NULL;
+    }
+
     return SDL_ConvertSurfaceRectAndColorspace(surface, NULL, format, NULL, SDL_GetDefaultColorspaceForFormat(format), surface->props);
 }