[FFmpeg-cvslog] Fixed segfault with wavpack decoder on corrupted decorrelation terms sub-blocks .

Laurent Aimar git at videolan.org
Sun Dec 25 01:36:00 CET 2011


ffmpeg | branch: release/0.6 | Laurent Aimar <fenrir at videolan.org> | Wed Sep  7 21:43:03 2011 +0200| [5394cdf7759ca12f0dde2c31483ecb5f3450afda] | committer: Reinhard Tartler

Fixed segfault with wavpack decoder on corrupted decorrelation terms sub-blocks.

Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit 8bfea4ab4e2cb32bc7bf6f697ee30a238c65d296)

Signed-off-by: Anton Khirnov <anton at khirnov.net>
Signed-off-by: Reinhard Tartler <siretart at tauware.de>

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

 libavcodec/wavpack.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index db83c44..43f28a6 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -776,12 +776,13 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
         }
         switch(id & WP_IDF_MASK){
         case WP_ID_DECTERMS:
-            s->terms = size;
-            if(s->terms > MAX_TERMS){
+            if(size > MAX_TERMS){
                 av_log(avctx, AV_LOG_ERROR, "Too many decorrelation terms\n");
+                s->terms = 0;
                 buf += ssize;
                 continue;
             }
+            s->terms = size;
             for(i = 0; i < s->terms; i++) {
                 s->decorr[s->terms - i - 1].value = (*buf & 0x1F) - 5;
                 s->decorr[s->terms - i - 1].delta = *buf >> 5;



More information about the ffmpeg-cvslog mailing list