[FFmpeg-devel] [PATCH 5/5] avcodec/hevc_ps: Check depth to be within 8 to 16

Michael Niedermayer michael at niedermayer.cc
Mon Apr 17 01:25:18 EEST 2023


Fixes: assertion failure in bitreader
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-627318668066816

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

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 2f505ba2f7a..d8664ebda7b 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -1545,6 +1545,10 @@ static int pps_scc_extension(GetBitContext *gb, AVCodecContext *avctx,
             pps->luma_bit_depth_entry_minus8 = get_ue_golomb(gb);
             if (!pps->monochrome_palette_flag)
                 pps->chroma_bit_depth_entry_minus8 = get_ue_golomb(gb);
+
+            if (pps->chroma_bit_depth_entry_minus8 > 8 || pps->chroma_bit_depth_entry_minus8 > 8)
+                return AVERROR_INVALIDDATA;
+
             num_comps = pps->monochrome_palette_flag ? 1 : 3;
             for (int comp = 0; comp < num_comps; comp++)
                 for (int i = 0; i < pps->pps_num_palette_predictor_initializers; i++)
-- 
2.17.1



More information about the ffmpeg-devel mailing list