summaryrefslogtreecommitdiff
path: root/libavcodec/cook.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-17 03:42:48 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-17 03:43:17 +0100
commit774830050aff71bcf02c68c0767f401240385842 (patch)
treecd23d0975b6f84b5faaeca7048d42f9aae3f1f8d /libavcodec/cook.c
parent84281d111c957f8c71691178bdcbc66c7c352f41 (diff)
cook: check subbands more completely, fix out of array read.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/cook.c')
-rw-r--r--libavcodec/cook.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/cook.c b/libavcodec/cook.c
index a02dd86744..0092f25307 100644
--- a/libavcodec/cook.c
+++ b/libavcodec/cook.c
@@ -1197,6 +1197,10 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
av_log_ask_for_sample(avctx, "subbands > 50\n");
return AVERROR_PATCHWELCOME;
}
+ if (q->subpacket[s].subbands == 0) {
+ av_log_ask_for_sample(avctx, "subbands is 0\n");
+ return AVERROR_PATCHWELCOME;
+ }
q->subpacket[s].gains1.now = q->subpacket[s].gain_1;
q->subpacket[s].gains1.previous = q->subpacket[s].gain_2;
q->subpacket[s].gains2.now = q->subpacket[s].gain_3;