aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2013-09-04 19:26:36 +0200
committerReinhard Tartler <siretart@tauware.de>2014-01-05 17:30:53 -0500
commit5bbee02ae04f3c49ae7f76f510fb1702761c0f15 (patch)
tree6408d6b261afd75cc93cbf30944040b11beaaca4 /libavcodec
parentf53a5332b017da21e57da2d5f4e5e56bfa5f2f2f (diff)
downloadffmpeg-5bbee02ae04f3c49ae7f76f510fb1702761c0f15.tar.gz
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 b2148faca9e9e553c14b27844b56e367c85a777e) Signed-off-by: Reinhard Tartler <siretart@tauware.de>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/shorten.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index fda90fedfe..ea2277218d 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -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 },
{ 2, -1, 0 },
{ 3, -3, 1 }
@@ -306,7 +307,12 @@ static int decode_subframe_lpc(ShortenContext *s, int command, int channel,
} else {
/* fixed LPC coeffs */
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;
}