[FFmpeg-devel] [PATCH 1/3] avcodec/cbs_h265_syntax_template: Check inter_ref_pic_set_prediction_flag

Michael Niedermayer michael at niedermayer.cc
Sat Jun 6 19:03:45 EEST 2020


Fixes: out of array access
Fixes: 23034/clusterfuzz-testcase-minimized-ffmpeg_BSF_HEVC_METADATA_fuzzer-5074645169733632.fuzz

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/cbs_h265_syntax_template.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c
index 5b7d1aa837..900764a3cf 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -518,8 +518,11 @@ static int FUNC(st_ref_pic_set)(CodedBitstreamContext *ctx, RWContext *rw,
 
     if (st_rps_idx != 0)
         flag(inter_ref_pic_set_prediction_flag);
-    else
+    else {
         infer(inter_ref_pic_set_prediction_flag, 0);
+        if (current->inter_ref_pic_set_prediction_flag)
+            return AVERROR_INVALIDDATA;
+    }
 
     if (current->inter_ref_pic_set_prediction_flag) {
         unsigned int ref_rps_idx, num_delta_pocs, num_ref_pics;
-- 
2.17.1



More information about the ffmpeg-devel mailing list