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 2596 - SDL_SetError fails on on NULL on systems with vsnprintf
Summary: SDL_SetError fails on on NULL on systems with vsnprintf
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.1
Hardware: x86_64 Android (All)
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-20 18:17 UTC by sfalexrog
Modified: 2014-06-21 18:53 UTC (History)
1 user (show)

See Also:


Attachments
A possible solution to the crashing problem (429 bytes, patch)
2014-06-20 18:27 UTC, sfalexrog
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description sfalexrog 2014-06-20 18:17:39 UTC
On systems with vsnprintf call SDL_SetError fails when passed a NULL as an argument. SDL's implementation checks for NULL (as seen in the commit: https://hg.libsdl.org/SDL/rev/5ba49d7a39a0), but system implementation may crash.

Please add a check if text == NULL at SDL_string.c, line 1279.
Comment 1 sfalexrog 2014-06-20 18:27:20 UTC
Created attachment 1695 [details]
A possible solution to the crashing problem

I did exactly the same thing as in https://hg.libsdl.org/SDL/rev/5ba49d7a39a0
Comment 2 sfalexrog 2014-06-20 18:28:27 UTC
(In reply to sfalexrog from comment #0)
> On systems with vsnprintf call SDL_SetError fails when passed a NULL as an
> argument. SDL's implementation checks for NULL (as seen in the commit:
> https://hg.libsdl.org/SDL/rev/5ba49d7a39a0), but system implementation may
> crash.
> 
> Please add a check if text == NULL at SDL_string.c, line 1279.

A correction: I've meant the fmt pointer, not text.
Comment 3 Sam Lantinga 2014-06-21 18:53:19 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/75c7095a5e8e