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] avcodec/h263dec: Check against previous dimensions instead of coded
Date: Sun, 20 Apr 2025 18:31:35 +0200
Message-ID: <GV1P250MB07370ECFCE27705129BD56738FB92@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20250130015722.2069524-1-michael@niedermayer.cc>

Michael Niedermayer:
> Fixes: out of array access
> Fixes: crash-a41ef3db699013f669b076f02f36942925f5a98c
> 
> Found-by: Kacper Michajlow <kasper93@gmail.com>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/h263dec.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
> index 0c23012584e..5eefdc4602b 100644
> --- a/libavcodec/h263dec.c
> +++ b/libavcodec/h263dec.c
> @@ -431,6 +431,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict,
>      MpegEncContext *s  = avctx->priv_data;
>      int ret;
>      int slice_ret = 0;
> +    int bak_width, bak_height;
>  
>      /* no supplementary picture */
>      if (buf_size == 0) {
> @@ -482,6 +483,9 @@ retry:
>      if (ret < 0)
>          return ret;
>  
> +    bak_width  = s->width;
> +    bak_height = s->height;
> +
>      /* let's go :-) */
>      if (CONFIG_WMV2_DECODER && s->msmpeg4_version == MSMP4_WMV2) {
>          ret = ff_wmv2_decode_picture_header(s);
> @@ -501,11 +505,12 @@ retry:
>      }
>  
>      if (ret < 0 || ret == FRAME_SKIPPED) {
> -        if (   s->width  != avctx->coded_width
> -            || s->height != avctx->coded_height) {
> +        if (   s->width  != bak_width
> +            || s->height != bak_height) {
>                  av_log(s->avctx, AV_LOG_WARNING, "Reverting picture dimensions change due to header decoding failure\n");
> -                s->width = avctx->coded_width;
> -                s->height= avctx->coded_height;
> +                s->width = bak_width;
> +                s->height= bak_height;
> +
>          }
>      }
>      if (ret == FRAME_SKIPPED)


Can I have the testcase?

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

  parent reply	other threads:[~2025-04-20 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-30  1:57 Michael Niedermayer
2025-01-30  8:15 ` Kacper Michajlow
2025-01-31 22:10   ` Michael Niedermayer
2025-04-20 16:31 ` Andreas Rheinhardt [this message]
2025-04-20 20:42   ` 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=GV1P250MB07370ECFCE27705129BD56738FB92@GV1P250MB0737.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