fix two invalid-file crashes found by fuzz testing
This commit is contained in:
parent
2073403a5f
commit
69a318bdb3
@ -3715,6 +3715,8 @@ static int start_decoder(vorb *f)
|
||||
ordered = get_bits(f,1);
|
||||
c->sparse = ordered ? 0 : get_bits(f,1);
|
||||
|
||||
if (c->dimensions == 0 && c->entries != 0) return error(f, VORBIS_invalid_setup);
|
||||
|
||||
if (c->sparse)
|
||||
lengths = (uint8 *) setup_temp_malloc(f, c->entries);
|
||||
else
|
||||
@ -3998,6 +4000,7 @@ static int start_decoder(vorb *f)
|
||||
if (f->residue_types[i] > 2) return error(f, VORBIS_invalid_setup);
|
||||
r->begin = get_bits(f, 24);
|
||||
r->end = get_bits(f, 24);
|
||||
if (r->end < r->begin) return error(f, VORBIS_invalid_setup);
|
||||
r->part_size = get_bits(f,24)+1;
|
||||
r->classifications = get_bits(f,6)+1;
|
||||
r->classbook = get_bits(f,8);
|
||||
|
@ -8,7 +8,7 @@ extern void stb_vorbis_dumpmem(void);
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
size_t memlen;
|
||||
unsigned char *mem = stb_fileu("c:/x/vorbis/1.ogg", &memlen);
|
||||
unsigned char *mem = stb_fileu("c:/x/vorbis/4.ogg", &memlen);
|
||||
int chan, samplerate;
|
||||
short *output;
|
||||
int samples = stb_vorbis_decode_memory(mem, memlen, &chan, &samplerate, &output);
|
||||
|
Loading…
Reference in New Issue
Block a user