fix crash from invalid file

This commit is contained in:
Sean Barrett 2015-11-08 14:04:56 -08:00
parent ea88e59b5d
commit 70b33e99f0

View File

@ -1906,7 +1906,7 @@ static int codebook_decode_deinterleave_repeat_2(vorb *f, Codebook *c, float **o
} }
} else { } else {
i=0; i=0;
if (c_inter == 1) { if (c_inter == 1 && i < effective) {
float val = CODEBOOK_ELEMENT_FAST(c,z+i) + last; float val = CODEBOOK_ELEMENT_FAST(c,z+i) + last;
if (outputs[c_inter]) if (outputs[c_inter])
outputs[c_inter][p_inter] += val; outputs[c_inter][p_inter] += val;
@ -2176,7 +2176,7 @@ static void decode_residue(vorb *f, float *residue_buffers[], int ch, int n, int
goto done; goto done;
#else #else
// saves 1% // saves 1%
if (!codebook_decode_deinterleave_repeat_2(f, book, residue_buffers, &c_inter, &p_inter, n, r->part_size)) if (!codebook_decode_deinterleave_repeat(f, book, residue_buffers, ch, &c_inter, &p_inter, n, r->part_size))
goto done; goto done;
#endif #endif
stb_prof(7); stb_prof(7);