aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-30 01:19:17 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-02 02:20:10 +0100
commite2865d931618deb65659343f185a0f77cf000296 (patch)
tree9e8ce2d3a2d0dbed593a20fc86fb611b6074398f
parentbde9e859b3c7ebb0f76437dd6457a41ac8904740 (diff)
downloadffmpeg-e2865d931618deb65659343f185a0f77cf000296.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) Conflicts: libavcodec/g2meet.c Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/g2meet.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index 1634059f16..bcf6cb05d3 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -716,7 +716,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) {
+ 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);