adpcm-thp: fix invalid array indexing

Indexing outside array limits is invalid and breaks with gcc 4.8.

Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
Mans Rullgard 2012-04-29 01:17:37 +01:00
parent c81d1e2390
commit a812ed003f
1 changed files with 6 additions and 4 deletions

View File

@ -1209,12 +1209,14 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
int prev[2][2]; int prev[2][2];
int ch; int ch;
for (i = 0; i < 32; i++) for (i = 0; i < 2; i++)
table[0][i] = sign_extend(bytestream2_get_be16u(&gb), 16); for (n = 0; n < 16; n++)
table[i][n] = sign_extend(bytestream2_get_be16u(&gb), 16);
/* Initialize the previous sample. */ /* Initialize the previous sample. */
for (i = 0; i < 4; i++) for (i = 0; i < 2; i++)
prev[0][i] = sign_extend(bytestream2_get_be16u(&gb), 16); for (n = 0; n < 2; n++)
prev[i][n] = sign_extend(bytestream2_get_be16u(&gb), 16);
for (ch = 0; ch <= st; ch++) { for (ch = 0; ch <= st; ch++) {
samples = (short *)c->frame.data[0] + ch; samples = (short *)c->frame.data[0] + ch;