[FFmpeg-cvslog] avcodec/dvbsubdec: check region dimensions

Michael Niedermayer git at videolan.org
Mon May 8 17:06:31 EEST 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon May  8 15:17:31 2017 +0200| [0075d9eced22839fa4f7a6eaa02155803ccae3e6] | committer: Michael Niedermayer

avcodec/dvbsubdec: check region dimensions

Fixes: 1408/clusterfuzz-testcase-minimized-6529985844084736
Fixes: integer overflow

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/dvbsubdec.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 446371e811..e332e8a866 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -24,6 +24,7 @@
 #include "bytestream.h"
 #include "internal.h"
 #include "libavutil/colorspace.h"
+#include "libavutil/imgutils.h"
 #include "libavutil/opt.h"
 
 #define DVBSUB_PAGE_SEGMENT     0x10
@@ -1127,6 +1128,7 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx,
     DVBSubObject *object;
     DVBSubObjectDisplay *display;
     int fill;
+    int ret;
 
     if (buf_size < 10)
         return AVERROR_INVALIDDATA;
@@ -1155,6 +1157,12 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx,
     region->height = AV_RB16(buf);
     buf += 2;
 
+    ret = av_image_check_size(region->width, region->height, 0, avctx);
+    if (ret < 0) {
+        region->width= region->height= 0;
+        return ret;
+    }
+
     if (region->width * region->height != region->buf_size) {
         av_free(region->pbuf);
 



More information about the ffmpeg-cvslog mailing list