Skip to content

mp3dec_load_cb: clamp VBR frame count to size_t (32-bit OOB write) - #150

Open
yuunnn wants to merge 1 commit into
lieff:masterfrom
yuunnn:fix-vbr-alloc-overflow
Open

mp3dec_load_cb: clamp VBR frame count to size_t (32-bit OOB write)#150
yuunnn wants to merge 1 commit into
lieff:masterfrom
yuunnn:fix-vbr-alloc-overflow

Conversation

@yuunnn

@yuunnn yuunnn commented Aug 2, 2026

Copy link
Copy Markdown

Crafted Xing/Info tag with huge frames -> detected_samples up to ~4.9e12.
allocated += detected_samples*sizeof(sample) wraps size_t on 32-bit builds,
malloc() gets a tiny buffer, first decoded frame writes 4608 bytes past it.

$ clang -D__SIZE_TYPE__='unsigned int' -fsanitize=address ...
ERROR: AddressSanitizer: heap-buffer-overflow
WRITE of size 2 at 0x...482  minimp3.h:1462 mp3d_synth_pair

64-bit unaffected. After fix: MP3D_E_MEMORY on crafted input.

Related: #140 (DoS only; this is the memory-corruption side).

Malicious Xing/Info frames value makes detected_samples huge; allocated
+= detected_samples*sizeof(sample) wraps size_t on 32-bit builds and
yields a tiny buffer -> heap-buffer-overflow in mp3d_synth_pair.

64-bit unaffected. Refs lieff#140.
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.

1 participant