Repository navigation
[raudio] Check input data before loading Wave or Music from memory - #6324
Merged
raysan5 merged 1 commit intoOct 24, 2026
Merged
Conversation
Owner
|
@akashdeshmukh-git thanks for the review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
LoadWaveFromMemory()did not checkfileDatafor NULL ordataSize <= 0, passing invalid pointers directly into underlying decoders (drwav_init_memory,stb_vorbis_open_memory, etc.).LoadMusicStreamFromMemory()did not checkfileTypefor NULL, causing a segmentation fault instrcmp()when an extension is missing, nor did it checkdatafor NULL ordataSize <= 0.How to reproduce
Call
LoadMusicStreamFromMemory(NULL, ...)to trigger a crash instrcmp(), or callLoadWaveFromMemory(".wav", NULL, 0)with a NULL buffer.What changed
Added security checks in
LoadWaveFromMemory()andLoadMusicStreamFromMemory()to validatefileType,fileData/data, anddataSize > 0before attempting to decode, matching the existing checks inLoadImageFromMemory().How it was tested
Verified with test calls passing NULL buffers and NULL fileType extensions; both functions now log a warning and return empty structs instead of crashing or invoking decoders on invalid memory. Built examples cleanly with GCC.