]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/dvbsubdec: Check object position
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 5 Mar 2019 19:14:05 +0000 (20:14 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 14 Mar 2019 15:24:35 +0000 (16:24 +0100)
Reference: ETSI EN 300 743 V1.2.1  7.2.2 Region composition segment

Fixes: Timeout
Fixes: 13325/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DVBSUB_fuzzer-5143979392237568
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/dvbsubdec.c

index b59e8366570ee92c6dd27a4b3ab0a14aacf0e775..bc4a17bde0ffa726a9828310446fcf881c98b3c0 100644 (file)
@@ -1267,6 +1267,13 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx,
         display->y_pos = AV_RB16(buf) & 0xfff;
         buf += 2;
 
+        if (display->x_pos >= region->width ||
+            display->y_pos >= region->height) {
+            av_log(avctx, AV_LOG_ERROR, "Object outside region\n");
+            av_free(display);
+            return AVERROR_INVALIDDATA;
+        }
+
         if ((object->type == 1 || object->type == 2) && buf+1 < buf_end) {
             display->fgcolor = *buf++;
             display->bgcolor = *buf++;