avcodec/hevc_ps: Check depth to be within 8 to 16

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@niedermayer.cc>
pull/389/head
Michael Niedermayer 2 years ago
parent e2e34c7731
commit cb8180aa66
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 4
      libavcodec/hevc_ps.c

@ -1557,6 +1557,10 @@ static int pps_scc_extension(GetBitContext *gb, AVCodecContext *avctx,
pps->luma_bit_depth_entry = get_ue_golomb_31(gb) + 8;
if (!pps->monochrome_palette_flag)
pps->chroma_bit_depth_entry = get_ue_golomb_31(gb) + 8;
if (pps->chroma_bit_depth_entry > 16 || pps->chroma_bit_depth_entry > 16)
return AVERROR_INVALIDDATA;
num_comps = pps->monochrome_palette_flag ? 1 : 3;
for (int comp = 0; comp < num_comps; comp++) {
int bit_depth = !comp ? pps->luma_bit_depth_entry : pps->chroma_bit_depth_entry;

Loading…
Cancel
Save