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) - SDL_CreateTexture allows illegal texture sizes
Summary: SDL_CreateTexture allows illegal texture sizes
Status: RESOLVED FIXED
Alias: Textur
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: HG 2.0
Hardware: x86 Linux
: P2 minor
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-30 02:34 UTC by Lloyd Bryant
Modified: 2013-10-01 05:17 UTC (History)
1 user (show)

See Also:


Attachments
patch to enforce maximum size limits for SDL_CreateTexture() (577 bytes, patch)
2013-09-30 02:34 UTC, Lloyd Bryant
Details | Diff
Test case (1.99 KB, text/plain)
2013-09-30 02:37 UTC, Lloyd Bryant
Details
Patch - enforce texture size limits for SDL_CreateTexture() (578 bytes, patch)
2013-10-01 03:53 UTC, Lloyd Bryant
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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