avcodec/ivi: Check image dimensions
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 14 Nov 2015 00:36:22 +0000 (01:36 +0100)
committerMike Gabriel <sunweaver@debian.org>
Sat, 31 Aug 2019 15:36:55 +0000 (16:36 +0100)
avcodec/ivi: Check image dimensions

Fixes integer overflow
Fixes: 1e32c6c591d940337c20b197ec1c4d3d/asan_heap-oob_4a52e5_8946_0bb0d9e863def56005e49f1d89bdc94d.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Gbp-Pq: Name CVE-2015-8364.patch

libavcodec/ivi_common.c

index 7c4d53ecec686d911d6d03638bf6861523685603..9ff5cfa5b45475f7ebb0e9c175d98d07a3a9b2a3 100644 (file)
@@ -30,6 +30,7 @@
 
 #define BITSTREAM_READER_LE
 #include "libavutil/attributes.h"
+#include "libavutil/imgutils.h"
 #include "libavutil/timer.h"
 #include "avcodec.h"
 #include "get_bits.h"
@@ -312,7 +313,7 @@ av_cold int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg,
 
     ivi_free_buffers(planes);
 
-    if (cfg->pic_width < 1 || cfg->pic_height < 1 ||
+    if (av_image_check_size(cfg->pic_width, cfg->pic_height, 0, NULL) < 0 ||
         cfg->luma_bands < 1 || cfg->chroma_bands < 1)
         return AVERROR_INVALIDDATA;