[FFmpeg-cvslog] avcodec/dvbsubdec: Check object position

Michael Niedermayer git at videolan.org
Fri May 10 22:03:06 EEST 2019


ffmpeg | branch: release/3.2 | Michael Niedermayer <michael at niedermayer.cc> | Tue Mar  5 20:14:05 2019 +0100| [5d28b2dc3737cdd5799e0bdb3593d94f604e8fc6] | committer: Michael Niedermayer

avcodec/dvbsubdec: Check object position

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 at niedermayer.cc>
(cherry picked from commit a8c5ae451184e879fc8ff1333c6f26f9542c8ebf)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 9525cb7885..7e341ee976 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -1353,6 +1353,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++;



More information about the ffmpeg-cvslog mailing list