Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 4/5] avcodec/hevcdec: Check ref frame
Date: Sat, 27 Apr 2024 12:14:18 +0200
Message-ID: <AS8P250MB0744254CEC3636DE2C72948A8F152@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20240426235211.3718252-4-michael@niedermayer.cc>

Michael Niedermayer:
> Fixes: NULL pointer dereferences
> Fixes: 68197/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6382538823106560
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/hevcdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> index fcfb275f63a..92b0e45eee0 100644
> --- a/libavcodec/hevcdec.c
> +++ b/libavcodec/hevcdec.c
> @@ -1969,13 +1969,13 @@ static void hls_prediction_unit(HEVCLocalContext *lc, int x0, int y0,
>  
>      if (current_mv.pred_flag & PF_L0) {
>          ref0 = refPicList[0].ref[current_mv.ref_idx[0]];
> -        if (!ref0 || !ref0->frame->data[0])
> +        if (!ref0 || !ref0->frame || !ref0->frame->data[0])
>              return;
>          hevc_await_progress(s, ref0, &current_mv.mv[0], y0, nPbH);
>      }
>      if (current_mv.pred_flag & PF_L1) {
>          ref1 = refPicList[1].ref[current_mv.ref_idx[1]];
> -        if (!ref1 || !ref1->frame->data[0])
> +        if (!ref1 || !ref1->frame || !ref1->frame->data[0])
>              return;
>          hevc_await_progress(s, ref1, &current_mv.mv[1], y0, nPbH);
>      }

Same as with 1/5: Checking for !ref0->frame is enough as HEVCFrame.f is
set if and only if the HEVCFrame.f->data[0] is set (with the possible
exception of hw-accelerated pixel formats that don't use AVFrame.data at
all (I don't know whether they exist); in any case, HEVCFrame.f is set
if and only if HEVCFrame.f->buf[0] is set).
Actually, I checked all the decoder that I ported to ProgressFrames for
this pattern, but apparently I overlooked way too much (maybe I only
checked for the ->buf[0] pattern?). Sorry for that.

- Andreas

_______________________________________________
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".

  reply	other threads:[~2024-04-27 10:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26 23:52 [FFmpeg-devel] [PATCH 1/5] avcodec/pngdec: Check last AVFrame before deref Michael Niedermayer
2024-04-26 23:52 ` [FFmpeg-devel] [PATCH 2/5] avcodec/vp3: Call ff_progress_frame_unref() before ff_progress_frame_get_buffer() Michael Niedermayer
2024-04-27  9:47   ` Andreas Rheinhardt
2024-04-27 18:15     ` Michael Niedermayer
2024-04-26 23:52 ` [FFmpeg-devel] [PATCH 3/5] avcodec/decode: Check progress before dereferencing Michael Niedermayer
2024-04-27 11:13   ` Andreas Rheinhardt
2024-06-25 19:47     ` Michael Niedermayer
2024-06-25 19:51       ` Andreas Rheinhardt
2024-04-26 23:52 ` [FFmpeg-devel] [PATCH 4/5] avcodec/hevcdec: Check ref frame Michael Niedermayer
2024-04-27 10:14   ` Andreas Rheinhardt [this message]
2024-04-27 18:23     ` Michael Niedermayer
2024-04-26 23:52 ` [FFmpeg-devel] [PATCH 5/5] avformat/mov: Check if heif item name is already allocated Michael Niedermayer
2024-04-26 23:57   ` James Almer
2024-04-27  0:03     ` Michael Niedermayer
2024-04-27  0:23       ` James Almer
2024-04-27 23:19         ` James Almer
2024-04-27  9:36 ` [FFmpeg-devel] [PATCH 1/5] avcodec/pngdec: Check last AVFrame before deref Andreas Rheinhardt
2024-04-27 18:13   ` Michael Niedermayer

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=AS8P250MB0744254CEC3636DE2C72948A8F152@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --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