aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2011-09-07 21:43:03 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-21 18:01:13 +0200
commit82e4fd193fe5e9173d081bd244a3b5326bcab01f (patch)
treea92c7de90b1ce04baea2045024bb8546d190be6a
parent3a0649ddebb9e23f8a3df44168d0afe9955c7b0e (diff)
downloadffmpeg-82e4fd193fe5e9173d081bd244a3b5326bcab01f.tar.gz
Fixed segfault with wavpack decoder on corrupted decorrelation terms sub-blocks.
Signed-off-by: Martin Storsjö <martin@martin.st> (cherry picked from commit 8bfea4ab4e2cb32bc7bf6f697ee30a238c65d296)
-rw-r--r--libavcodec/wavpack.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 61a75fd765..a785b90046 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -862,12 +862,13 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
}
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;