From d5a578531bdf29f4bd062c2c6dcfee57ecca507e Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 26 May 2015 16:42:36 -0400 Subject: [PATCH] Drop out of SDL_UpdateTexture() early if the rectangle is zero pixels. Hopefully makes static analysis happy about a zero-byte malloc elsewhere. --- src/render/SDL_render.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index d6a986d0c..e7f823c9d 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -820,7 +820,9 @@ SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect, rect = &full_rect; } - if (texture->yuv) { + if ((rect->w == 0) || (rect->h == 0)) { + return 0; /* nothing to do. */ + } else if (texture->yuv) { return SDL_UpdateTextureYUV(texture, rect, pixels, pitch); } else if (texture->native) { return SDL_UpdateTextureNative(texture, rect, pixels, pitch);