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
stb_vorbis: undefined behaviour causes audio distortions when ubsan is enabled #1563
base: master
Are you sure you want to change the base?
Conversation
Fixes distorted decompressed audio when UBSan was enabled.
Patch by Seb de Graffenried (@Seb-degraff): nothings/stb#1563 Fixes distorted decompressed audio when UBSan was enabled.
Patch by Seb de Graffenried (@Seb-degraff): nothings/stb#1563 Fixes distorted decompressed audio when UBSan was enabled.
Patch by Seb de Graffenried (@Seb-degraff): nothings/stb#1563 Fixes distorted decompressed audio when UBSan was enabled. (cherry picked from commit c015a42)
Patch by Seb de Graffenried (@Seb-degraff): nothings/stb#1563 Fixes distorted decompressed audio when UBSan was enabled.
Patch by Seb de Graffenried (@Seb-degraff): nothings/stb#1563 Fixes distorted decompressed audio when UBSan was enabled.
Patch by Seb de Graffenried (@Seb-degraff): nothings/stb#1563 Fixes distorted decompressed audio when UBSan was enabled. Backported from mainstream: libsdl-org/SDL_mixer@c015a42
…audio when UBSan was enabled. nothings#1563
This is weird - I don't see how (and FWIW, on my Linux amd64 system, with clang 14, your repro always says |
Oh interesting! Thank you for looking into it. I’ll do more testing on my side |
Fixes distorted decompressed audio when UBSan was enabled.
I found an audio distortion issue while working on a game. This bug seems petty harmless since it shows up only when ubsan is enabled (for me at least). However – since I was not listening to audio at the time at enabled ubsan – it took me a little while to link the audio distortion bug to the fact that ubsan was enabled. Fixing this might save others the trouble!
Distorted audio (ubsan enabled): https://github.com/nothings/stb/assets/6556843/a92daa96-4ac0-4c3f-aa03-4e58d161dd78
Correct audio (ubsan disabled): https://github.com/nothings/stb/assets/6556843/a932be22-d25d-4158-8f16-e3effc583416
Minimal repro: stb_vorbis_ubsan_bug_repro.zip
Running run_repro.sh on my arm mac results in this input showing that the decoded data with and without ubsan don't match: