[FFmpeg-cvslog] shorten: Extend fixed_coeffs to properly support pred_order 0

Luca Barbato git at videolan.org
Wed Oct 9 11:18:09 CEST 2013


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Wed Sep  4 19:26:36 2013 +0200| [b2148faca9e9e553c14b27844b56e367c85a777e] | committer: Luca Barbato

shorten: Extend fixed_coeffs to properly support pred_order 0

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b2148faca9e9e553c14b27844b56e367c85a777e
---

 libavcodec/shorten.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 6a2f56e..5ca38c6 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -273,7 +273,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 }
@@ -302,7 +303,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;
     }
 



More information about the ffmpeg-cvslog mailing list