-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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: out-of-memory when allocating f->temp_mults (libFuzzer/ASan). #1248
Labels
Comments
AliceLR
changed the title
stb-vorbis: out-of-memory when allocating f->temp_mults (libFuzzer/ASan).
stb_vorbis: out-of-memory when allocating f->temp_mults (libFuzzer/ASan).
Nov 18, 2021
Two more inputs with the same ASan stack dump have shown up since. Updated test inputs zip: OGG_lookup_values_oom.zip |
sezero
added a commit
to libsdl-org/SDL_mixer
that referenced
this issue
Dec 11, 2023
sezero
added a commit
to libsdl-org/SDL_mixer
that referenced
this issue
Dec 11, 2023
sezero
added a commit
to icculus/SDL_sound
that referenced
this issue
Dec 11, 2023
sezero
added a commit
to libsdl-org/SDL_mixer
that referenced
this issue
Dec 11, 2023
sezero
added a commit
to libsdl-org/SDL_mixer
that referenced
this issue
Dec 11, 2023
sezero
added a commit
to icculus/SDL_sound
that referenced
this issue
Dec 11, 2023
sezero
added a commit
to sezero/stb
that referenced
this issue
Dec 12, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Certain inputs can cause stb_vorbis to attempt to allocate large amounts of RAM in
start_decoder
when loading codebook lookup values. There seems to be multiple problems here:codebook_entries
is a 24 bit value andcodebook_dimensions
is a 16 bit value, so the computedcodebook_lookup_values
can contain values up to 40 bits (this is allowed by the spec). However, this value is stored to auint32
. This isn't necessarily a problem by itself (probably no valid input relies on this), but given certain inputs, this can reach values >2.14b.codebook_lookup_values
is auint32
, butsetup_temp_malloc()
takes its size parameter as anint
(should probably instead besize_t
). This casts some large calculatedcodebook_lookup_values
values to negative integers. Insetup_temp_malloc()
, the aforementionedint sz
is then provided tomalloc
, which takes asize_t
parameter.sz
is sign extended and then interpreted as an extremely large unsigned value.malloc
for AddressSanitizer emits an error and aborts due to this whenallocator_may_return_null=0
. This is just a symptom of 2 and 3 though.To Reproduce
Load this test module with
stb_vorbis_decode_filename
from stb_vorbis built with AddressSanitizer or MemorySanitizer:OGG_lookup_values_oom.zip
Expected behavior
stb_vorbis should probably not attempt to allocate several exabytes of memory from an invalid input unless the input file can reasonably contain that many lookup values.
Screenshots
If I find any more of these inputs I'll attach them, but this is the only one that's come up so far.
The text was updated successfully, but these errors were encountered: