We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2122 (Textur)

Summary: SDL_CreateTexture allows illegal texture sizes
Product: SDL Reporter: Lloyd Bryant <lloydbaz>
Component: renderAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: minor    
Priority: P2 CC: philipp.wiesemann
Version: HG 2.0   
Hardware: x86   
OS: Linux   
Attachments: patch to enforce maximum size limits for SDL_CreateTexture()
Test case
Patch - enforce texture size limits for SDL_CreateTexture()

Description Lloyd Bryant 2013-09-30 02:34:50 UTC
Created attachment 1344 [details]
patch to enforce maximum size limits for SDL_CreateTexture()

SDL_CreateTexture() is succeeding (i.e. returning a valid pointer) when the requested horizontal or vertical size of the texture exceeds the maximum allowed by the render.  This results in hard-to-understand errors showing up when later attempting to use that texture (such as with SDL_SetRenderTarget()).

I'm attaching a patch to explicitly check these values against the render's maximums, and returning NULL and setting a meaningful error message if those limits are exceeded.

Patch was created with "hg diff", relative to the top level directory.

I also have a test case written up, but haven't figured out how to attach it and the patch at the same time...
Comment 1 Lloyd Bryant 2013-09-30 02:37:22 UTC
Created attachment 1345 [details]
Test case

Here's a simple program to demonstrate the bug
Comment 2 Philipp Wiesemann 2013-09-30 20:13:55 UTC
The error message contains a typo ("dimenions" [sic]).
Comment 3 Lloyd Bryant 2013-10-01 03:53:03 UTC
Created attachment 1347 [details]
Patch - enforce texture size limits for SDL_CreateTexture()

OK - take two on the patch, with that spelling error corrected.
Comment 4 Sam Lantinga 2013-10-01 05:17:02 UTC
Fixed, thanks!
http://hg.libsdl.org/SDL/rev/28031e0042b2