[FFmpeg-devel] [PATCH] avcodec/dvbsubdec: Check for duplicate regions in dvbsub_parse_page_segment()

Michael Niedermayer michael at niedermayer.cc
Tue Aug 22 04:56:41 EEST 2017


Fixes: OOM
Fixes: 3051/clusterfuzz-testcase-minimized-5745818336231424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/dvbsubdec.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 98619f9631..b683109643 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -1302,6 +1302,15 @@ static int dvbsub_parse_page_segment(AVCodecContext *avctx,
         region_id = *buf++;
         buf += 1;
 
+        display = ctx->display_list;
+        while (display && display->region_id != region_id) {
+            display = display->next;
+        }
+        if (display) {
+            av_log(avctx, AV_LOG_ERROR, "duplicate region\n");
+            break;
+        }
+
         display = tmp_display_list;
         tmp_ptr = &tmp_display_list;
 
-- 
2.14.1



More information about the ffmpeg-devel mailing list