[FFmpeg-devel] [PATCH] avcodec/hevcdec: Avoid only partly skiping duplicate first slices
Michael Niedermayer
michael at niedermayer.cc
Sat Mar 23 22:25:03 EET 2019
Fixes: NULL pointer dereference and out of array access
Fixes: 13871/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5746167087890432
Fixes: 13845/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5650370728034304
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/hevcdec.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 86adab0ae1..4d149f4d9f 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -488,6 +488,9 @@ static int hls_slice_header(HEVCContext *s)
// Coded parameters
sh->first_slice_in_pic_flag = get_bits1(gb);
+ if (s->ref && sh->first_slice_in_pic_flag)
+ return 0; // This slice will be skiped later, do not corrupt state
+
if ((IS_IDR(s) || IS_BLA(s)) && sh->first_slice_in_pic_flag) {
s->seq_decode = (s->seq_decode + 1) & 0xff;
s->max_ra = INT_MAX;
--
2.21.0
More information about the ffmpeg-devel
mailing list