Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed bug 1929 - SDL_Texture* from SDL_CreateTexture() causes GL_Bind…
Browse files Browse the repository at this point in the history
…Texture() to segfault

Charles Huber

If SDL_CreateTexture() takes the !IsSupportedFormat() path it will return a SDL_Texture* with a NULL driverdata member.

If you then SDL_GL_BindTexture() this will cause a segfault in GL_BindTexture() when it unconditionally dereferences driverdata.
  • Loading branch information
slouken committed Jun 26, 2013
1 parent 1a9b3ae commit 260a8e9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/render/SDL_render.c
Expand Up @@ -1739,11 +1739,13 @@ int SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh)

CHECK_TEXTURE_MAGIC(texture, -1);
renderer = texture->renderer;
if (renderer && renderer->GL_BindTexture) {
if (texture->native) {
return SDL_GL_BindTexture(texture->native, texw, texh);
} else if (renderer && renderer->GL_BindTexture) {
return renderer->GL_BindTexture(renderer, texture, texw, texh);
} else {
return SDL_Unsupported();
}

return SDL_Unsupported();
}

int SDL_GL_UnbindTexture(SDL_Texture *texture)
Expand Down

0 comments on commit 260a8e9

Please sign in to comment.