Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add null check to SDL_LoadWAV_RW to avoid crashes #311

Merged
merged 2 commits into from
Aug 6, 2023

Conversation

zmanuel
Copy link
Contributor

@zmanuel zmanuel commented Aug 6, 2023

Native SDL 1.2 and 2.0 both handle SDL_LoadWAV(null,...), SDL_LoadWAV("",...) and SDL_LoadWAV(nonexistent_file,...) by returning NULL and setting an error; this check resores that behavior.

Fixes #310

Native SDL 1.2 and 2.0 both handle SDL_LoadWAV(null,...), SDL_LoadWAV("",...) and SDL_LoadWAV(nonexistent_file,...)
by returning NULL and setting an error; this check resores that
behavior.

Fixes libsdl-org#310
@sezero sezero requested a review from icculus August 6, 2023 15:36
It is an out parameter and callers might be tempted to free it no matter
what the main return value says.
@icculus icculus merged commit 9150989 into libsdl-org:main Aug 6, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SDL_LoadWAV() crashes with invalid files
3 participants