[FFmpeg-cvslog] avcodec/g2meet: check tile dimensions to avoid integer overflow

Michael Niedermayer git at videolan.org
Fri Nov 28 20:02:31 CET 2014


ffmpeg | branch: release/2.1 | Michael Niedermayer <michaelni at gmx.at> | Thu Oct 30 01:19:17 2014 +0100| [ffd5ccee5df504ea8a9f0a8da71e2ce5433da728] | committer: Michael Niedermayer

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 at gmx.at>
(cherry picked from commit 32e666c354e4a3160d8cf1d303cb51990b095c87)

Conflicts:

	libavcodec/g2meet.c

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ffd5ccee5df504ea8a9f0a8da71e2ce5433da728
---

 libavcodec/g2meet.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index b83be23..a9c44cf 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -714,7 +714,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);



More information about the ffmpeg-cvslog mailing list