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

Summary: SDL_SetError fails on on NULL on systems with vsnprintf
Product: SDL Reporter: sfalexrog
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: sfalexrog
Version: HG 2.1   
Hardware: x86_64   
OS: Android (All)   
Attachments: A possible solution to the crashing problem

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