diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-10-30 01:19:17 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-11-01 15:40:38 +0100 |
commit | f6499563c3069ba4665906ed19fe80454ed00e1c (patch) | |
tree | 410d6eb07ea94b4d85000891197dacffebba15e4 | |
parent | 16a4aef34574549316ba1a96a26edd1c9a4fb1e3 (diff) | |
download | ffmpeg-f6499563c3069ba4665906ed19fe80454ed00e1c.tar.gz |
avcodec/g2meet: check tile dimensions to avoid integer overflow
Fixes out of array access
Fixes: asan_heap-oob_12a55d3_30_029.wmv
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 32e666c354e4a3160d8cf1d303cb51990b095c87)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/g2meet.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c index aaf1abb6dc..70419d8a2d 100644 --- a/libavcodec/g2meet.c +++ b/libavcodec/g2meet.c @@ -724,8 +724,10 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data, } c->tile_width = bytestream2_get_be32(&bc); c->tile_height = bytestream2_get_be32(&bc); - if (!c->tile_width || !c->tile_height || - ((c->tile_width | c->tile_height) & 0xF)) { + if (c->tile_width <= 0 || c->tile_height <= 0 || + ((c->tile_width | c->tile_height) & 0xF) || + c->tile_width * 4LL * c->tile_height >= INT_MAX + ) { av_log(avctx, AV_LOG_ERROR, "Invalid tile dimensions %dx%d\n", c->tile_width, c->tile_height); |