diff mbox series

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

Message ID 20230416222518.21308-5-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/5] avcodec/pcm_rechunk_bsf: unref packet before putting a new one in | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer April 16, 2023, 10:25 p.m. UTC
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>
---
 libavcodec/hevc_ps.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Michael Niedermayer April 30, 2023, 10:32 p.m. UTC | #1
On Mon, Apr 17, 2023 at 12:25:18AM +0200, Michael Niedermayer wrote:
> 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>
> ---
>  libavcodec/hevc_ps.c | 4 ++++
>  1 file changed, 4 insertions(+)

will apply with adaptions to current git master

[...]
diff mbox series

Patch

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++)