shorten: Extend fixed_coeffs to properly support pred_order 0

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit b2148faca9)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
This commit is contained in:
Luca Barbato
2013-09-04 19:26:36 +02:00
committed by Reinhard Tartler
parent f53a5332b0
commit 5bbee02ae0

View File

@@ -277,7 +277,8 @@ static void output_buffer(int16_t **samples, int nchan, int blocksize,
} }
} }
static const int fixed_coeffs[3][3] = { static const int fixed_coeffs[][3] = {
{ 0, 0, 0 },
{ 1, 0, 0 }, { 1, 0, 0 },
{ 2, -1, 0 }, { 2, -1, 0 },
{ 3, -3, 1 } { 3, -3, 1 }
@@ -306,7 +307,12 @@ static int decode_subframe_lpc(ShortenContext *s, int command, int channel,
} else { } else {
/* fixed LPC coeffs */ /* fixed LPC coeffs */
pred_order = command; pred_order = command;
coeffs = fixed_coeffs[pred_order - 1]; if (pred_order > FF_ARRAY_ELEMS(fixed_coeffs)) {
av_log(s->avctx, AV_LOG_ERROR, "invalid pred_order %d\n",
pred_order);
return AVERROR_INVALIDDATA;
}
coeffs = fixed_coeffs[pred_order];
qshift = 0; qshift = 0;
} }