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 - NULL access in SDL_ListModes
Summary: NULL access in SDL_ListModes
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: All Other
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-25 17:58 UTC by Max Horn
Modified: 2007-07-26 22:11 UTC (History)
0 users

See Also:


Attachments

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