Skip to content

[BOX32] Fix vorbis pcmout/lapout/analysis_buffer pointer conversion#3630

Merged
ptitSeb merged 2 commits intoptitSeb:mainfrom
runlevel5:fix-box32-vorbis-pcmout
Mar 9, 2026
Merged

[BOX32] Fix vorbis pcmout/lapout/analysis_buffer pointer conversion#3630
ptitSeb merged 2 commits intoptitSeb:mainfrom
runlevel5:fix-box32-vorbis-pcmout

Conversation

@runlevel5
Copy link
Contributor

The box32 wrappers for vorbis_synthesis_pcmout, vorbis_synthesis_lapout, and vorbis_analysis_buffer pass the caller's 32-bit pointer slot directly to the native 64-bit function. The native function writes an 8-byte float** into a 4-byte slot, corrupting adjacent stack memory and causing SIGSEGV in ov_read_filter.

Fix: use a local ptr_t[256] buffer to convert the native float** array to 32-bit pointers, then write a 32-bit pointer back to the caller.

Tested on both ARM64 and PPC64LE with an x86 32-bit test binary (emulated libvorbisfile.so.3 + wrapped libvorbis.so.0) — OGG decoding works correctly with the fix.

vorbis_synthesis_pcmout and vorbis_synthesis_lapout write a native
float** (8 bytes) into the caller-provided pointer slot, but 32-bit
callers only allocate 4 bytes for it. This corrupts adjacent stack
memory and causes SIGSEGV when the truncated pointer is dereferenced.

Use a static ptr_t[256] buffer to convert the native float** array
to 32-bit pointers, and write a 32-bit pointer to that buffer back
to the caller. Same fix for vorbis_analysis_buffer which returns
float**.
@ptitSeb
Copy link
Owner

ptitSeb commented Mar 9, 2026

LGTM, will test a bit later

@ptitSeb ptitSeb merged commit 46bea9b into ptitSeb:main Mar 9, 2026
30 checks passed
@ptitSeb
Copy link
Owner

ptitSeb commented Mar 9, 2026

I tested old WorldOfGoo 32bits linux binary, and it works fine now :)

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