From: Michael Niedermayer <michael@niedermayer.cc> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: [FFmpeg-devel] [PATCH 4/5] avcodec/hevc/hevcdec: Do not allow slices to depend on failed slices Date: Mon, 24 Jun 2024 01:01:36 +0200 Message-ID: <20240623230137.1749178-4-michael@niedermayer.cc> (raw) In-Reply-To: <20240623230137.1749178-1-michael@niedermayer.cc> An alternative would be to leave the context unchanged on failure of hls_slice_header() Fixes: out of array access Fixes: NULL pointer dereference Fixes: 69584/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5931086299856896 Fixes: 69724/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5104066422702080 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/hevcdec.c | 5 +++++ libavcodec/hevc/hevcdec.h | 1 + 2 files changed, 6 insertions(+) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 4dd84d4953c..0e0a910641f 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -626,6 +626,10 @@ static int hls_slice_header(SliceHeader *sh, const HEVCContext *s, GetBitContext if (pps->dependent_slice_segments_enabled_flag) sh->dependent_slice_segment_flag = get_bits1(gb); + if (sh->dependent_slice_segment_flag && sh->slice_failure) { + av_log(s->avctx, AV_LOG_ERROR, "dependent slice failed\n"); + return AVERROR_INVALIDDATA; + } slice_address_length = av_ceil_log2(sps->ctb_width * sps->ctb_height); @@ -3157,6 +3161,7 @@ static int decode_slice(HEVCContext *s, const H2645NAL *nal, GetBitContext *gb) int ret; ret = hls_slice_header(&s->sh, s, gb); + s->sh.slice_failure = ret; if (ret < 0) return ret; diff --git a/libavcodec/hevc/hevcdec.h b/libavcodec/hevc/hevcdec.h index da4d83e6615..91f20ea26ab 100644 --- a/libavcodec/hevc/hevcdec.h +++ b/libavcodec/hevc/hevcdec.h @@ -213,6 +213,7 @@ typedef struct SliceHeader { uint8_t first_slice_in_pic_flag; uint8_t dependent_slice_segment_flag; + uint8_t slice_failure; uint8_t pic_output_flag; uint8_t colour_plane_id; -- 2.45.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-06-23 23:02 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-06-23 23:01 [FFmpeg-devel] [PATCH 1/5] avcodec/aac/aacdec_usac: Test ac in usac Michael Niedermayer 2024-06-23 23:01 ` [FFmpeg-devel] [PATCH 2/5] avcodec/hevc/hevcdec: Do not allow changes to parameter sets between slices Michael Niedermayer 2024-06-25 8:59 ` Anton Khirnov 2024-06-25 23:27 ` Michael Niedermayer 2024-06-26 6:36 ` Anton Khirnov 2024-06-23 23:01 ` [FFmpeg-devel] [PATCH 3/5] avcodec/hevc/hevcdec: SPS not set (or cleared) after frame start Michael Niedermayer 2024-06-25 9:00 ` Anton Khirnov 2024-06-25 23:52 ` Michael Niedermayer 2024-06-26 6:38 ` Anton Khirnov 2024-06-26 23:05 ` Michael Niedermayer 2024-06-23 23:01 ` Michael Niedermayer [this message] 2024-06-25 9:04 ` [FFmpeg-devel] [PATCH 4/5] avcodec/hevc/hevcdec: Do not allow slices to depend on failed slices Anton Khirnov 2024-06-23 23:01 ` [FFmpeg-devel] [PATCH 5/5] avformat/iamf: Check substreams in ff_iamf_free_audio_element() Michael Niedermayer 2024-07-15 14:25 ` Michael Niedermayer 2024-07-15 15:16 ` James Almer 2024-06-25 23:35 ` [FFmpeg-devel] [PATCH 1/5] avcodec/aac/aacdec_usac: Test ac in usac Lynne via ffmpeg-devel 2024-06-25 23:57 ` Michael Niedermayer 2024-06-26 6:58 ` Lynne via ffmpeg-devel 2024-06-26 18:57 ` Michael Niedermayer 2024-06-26 19:45 ` Andreas Rheinhardt 2024-06-26 22:46 ` Lynne via ffmpeg-devel
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240623230137.1749178-4-michael@niedermayer.cc \ --to=michael@niedermayer.cc \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git