diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-10-30 16:53:09 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-11-01 15:40:38 +0100 |
commit | f00ec3307b5f61a5efbfa2a1d71817bb53fa397e (patch) | |
tree | 95fb4c4c275432f22f3f1234a436376bf5792e84 | |
parent | f6499563c3069ba4665906ed19fe80454ed00e1c (diff) | |
download | ffmpeg-f00ec3307b5f61a5efbfa2a1d71817bb53fa397e.tar.gz |
avcodec/cook: check that the subpacket sizes fit in block_align
Fixes out of array read
Fixes: asan_heap-oob_fb5c50_19_018.rmvb
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 10e32618acce9c3fc64c061eb7907e8a8d2749ae)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/cook.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 402093c425..48b79dfe27 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -1214,8 +1214,8 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) q->num_subpackets++; s++; - if (s > MAX_SUBPACKETS) { - avpriv_request_sample(avctx, "subpackets > %d", MAX_SUBPACKETS); + if (s > FFMIN(MAX_SUBPACKETS, avctx->block_align)) { + avpriv_request_sample(avctx, "subpackets > %d", FFMIN(MAX_SUBPACKETS, avctx->block_align)); return AVERROR_PATCHWELCOME; } } |