A crafted file may trigger out of buffer write in start_decoder at [1] and [2]
for (j=0; j < m->submaps; ++j) {
get_bits(f,8); // discard
m->submap_floor[j] = get_bits(f,8); // [1] Off by one write
m->submap_residue[j] = get_bits(f,8); // [2] Off by one write
if (m->submap_floor[j] >= f->floor_count) return error(f, VORBIS_invalid_setup);
if (m->submap_residue[j] >= f->residue_count) return error(f, VORBIS_invalid_setup);
}
/src/stb/tests/../stb_vorbis.c:4107:10: runtime error: index 15 out of bounds for type 'uint8[15]' (aka 'unsigned char[15]')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /src/stb/tests/../stb_vorbis.c:4107:10 in
A crafted file may trigger out of buffer write in
start_decoder
at [1] and [2]because at maximum
m->submaps
can be 16 [3]but
submap_floor
andsubmap_residue
are declared as arrays of 15 elements at [4] and [5]Impact
This issue may lead to code execution.
Resources
To reproduce the issue: