build(vorbis): update libvorbis past its negative left shift in the psychoacoustic setup #11480
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11480"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T16:35:57Z.
What
The bundled libvorbis (
3rdparty/vorbisat0657aee6) builds its bark table in_vp_psy_initwithp->bark[i]=((lo-1)<<16)+(hi-1);(lib/psy.c:319). For the first bandslois 0, so it left-shifts a negative value, which is undefined behaviour. With-fsanitize=undefinedandhalt_on_error,guest_vorbis_decstops there:psy.c:319:23: runtime error: left shift of negative value -4.Upstream fixed it in
c2aa86b0("Replaced left shift of negative number with multiplication"), which writes((lo-1)*(1<<16))+(hi-1), the same value without the shift. This moves the submodule to that commit instead of patching the file locally. Between the two commits, the library sources change only in four files, all fixes orconstqualifiers:psy.c: this fix, plus the half-octave bounds check in_vp_psy_init(315da9cc).sharedbook.c: a cast to unsigned to avoid another undefined shift (bb4047de).smallft.c: constants markedconst.vorbisfile.c: a misleading-indentation fix.The rest are upstream CMake, CI, test and documentation changes;
libSceVorbisDecbuilds the library from its own source list, so they do not affect this build.Tested
On an
ubuntu-latestfork runner:guest_vorbis_decandguest_ajm_wvorbispass.-DANYPS5_ENABLE_ASAN=ONwith-fsanitize=undefined -fno-sanitize=vptrandUBSAN_OPTIONS=halt_on_error=1: both pass. With the submodule checked out back at0657aee6in the same build,guest_vorbis_decfails withpsy.c:319:23: runtime error: left shift of negative value -4.python3 tools/check_conventions.py --base upstream/mainpasses andtools/pr_overlap.py --branchreports no overlap with open pull requests. Windows and macOS were not run.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)