SDL_mixer: Use after free bug in Mixer's `OPUS_Delete()` on macOS
There’s some background on this issue in the rust-sdl2 project. It seems that on the Mac while Wave files work happily if mixer is unload before the music file is but Opus causes a SEGFAULT.
Digging deeper, it turns out that there isn’t a proper guard in OPUS_Delete to make sure that the Opus library is still loaded.
The fix seems to be to make sure “opus.loaded” is greater than zero before calling opus.op_free().
Does this seem reasonable? Also, I noticed that you can leak the Opus libraries if calling OPUS_Load() more than once.
If this does make sense, I’m happy to write a merge request here. It seems like @Wohlstand would be a good mentor for this if they’re willing to help me out.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 21 (12 by maintainers)
Lemme check some…
Sounds like something paranormalic … 🤔