Skip to content

[raudio] LoadSoundAlias(): check source buffer before use - #6236

Merged
raysan5 merged 1 commit into
raysan5:masterfrom
akashdeshmukh-git:fix-loadsoundalias-null
Oct 8, 2026
Merged

raysan5 merged 1 commit into
raysan5:masterfrom
akashdeshmukh-git:fix-loadsoundalias-null

Conversation

@akashdeshmukh-git

Copy link
Copy Markdown
Contributor

If the source sound failed to load (for example when no audio playback device could be initialized), its stream.buffer is NULL and LoadSoundAlias() dereferenced it. This checks the buffer first, like UnloadSoundAlias() and IsSoundValid() already do, so an empty Sound is returned instead of crashing.

This is the audio_sound_multi crash reported in #5664. Reproduced with PLATFORM_MEMORY (no playback device) under ASan; with the fix it only logs the usual load warnings

If the source sound failed to load (for example when no audio
playback device could be initialized), its stream.buffer is NULL and
LoadSoundAlias() dereferenced it. Check the buffer first, like
UnloadSoundAlias() and IsSoundValid() already do, so an empty Sound
is returned instead of crashing.

Seen with examples/audio/audio_sound_multi (reported in raysan5#5664).
@raysan5
raysan5 merged commit 3825bbf into raysan5:master Oct 8, 2026
16 checks passed
@raysan5

raysan5 commented Oct 8, 2026

Copy link
Copy Markdown
Owner

@akashdeshmukh-git thanks for the review

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.

2 participants