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 469

Summary: NULL access in SDL_ListModes
Product: SDL Reporter: Max Horn <max>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: Other   

Description Max Horn 2007-07-25 17:58:05 UTC
Hi there,

I spotted the following in the SDL_compat.c code recently (but I didn't test whether it actually causes a crash): In SDL_ListModes, line 128, the pointer "modes" is set to NULL. Then, a few lines later (line 138), modes is read even though it is still NULL! Then a little bit later, SDL_realloc is called on it.

So it seems an initial SDL_malloc call is missing there.
Comment 1 Sam Lantinga 2007-07-26 22:11:14 UTC
This is not a bug.  The access of modes is protected by a check on nmodes, and realloc(NULL, size) works like malloc(size).