diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-04-21 19:28:35 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-05-06 00:47:44 +0200 |
commit | 1ca4e70b6c52601e376c672741a960761c0b2516 (patch) | |
tree | 9097d66d5c5b080023e309e9a48c2bba0f475c54 /libavcodec | |
parent | 25a28022390de45ca2c75497d213da51472f6c4f (diff) | |
download | ffmpeg-1ca4e70b6c52601e376c672741a960761c0b2516.tar.gz |
cook: check subacket count
Fixes out of array writes.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5a35bd92ad6b535fd5d3a7513169661de66ec247)
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/cook.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/cook.c b/libavcodec/cook.c index c963ffec25..3d6f0dec0a 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -1235,6 +1235,11 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) q->subpacket[s].gains2.now = q->subpacket[s].gain_3; q->subpacket[s].gains2.previous = q->subpacket[s].gain_4; + if (q->num_subpackets + q->subpacket[s].num_channels > q->nb_channels) { + av_log(avctx, AV_LOG_ERROR, "Too many subpackets %d for channels %d\n", q->num_subpackets, q->nb_channels); + return AVERROR_INVALIDDATA; + } + q->num_subpackets++; s++; if (s > MAX_SUBPACKETS) { |