aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-30 16:53:09 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-10-30 17:23:37 +0100
commit25d2a4dde7240e05f5098c6d50ae3d534463dd79 (patch)
treee989fe70e602161ee04e9bd30564d2e9827dc04a /libavcodec
parentbfee1e90725aa2b832a0fd7bbd0393c9c23e7f0a (diff)
downloadffmpeg-25d2a4dde7240e05f5098c6d50ae3d534463dd79.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>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/cook.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/cook.c b/libavcodec/cook.c
index 5860288e04..4f83c9dc25 100644
--- a/libavcodec/cook.c
+++ b/libavcodec/cook.c
@@ -1215,8 +1215,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;
}
}