Skip to content

Commit

Permalink
Drop out of SDL_UpdateTexture() early if the rectangle is zero pixels.
Browse files Browse the repository at this point in the history
Hopefully makes static analysis happy about a zero-byte malloc elsewhere.
  • Loading branch information
icculus committed May 26, 2015
1 parent 2e2b84f commit d5a5785
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/render/SDL_render.c
Expand Up @@ -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);
Expand Down

0 comments on commit d5a5785

Please sign in to comment.