Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] mov demuxer: Check if a key is longer than the atom containing it
Date: Tue, 2 Apr 2024 00:18:25 -0300
Message-ID: <3b44c3e2-f421-4b65-984f-5568e9095f6b@gmail.com> (raw)
In-Reply-To: <20240402022928.585868-2-ezemtsov@google.com>

On 4/1/2024 11:28 PM, Eugene Zemtsov via ffmpeg-devel wrote:
> From: Eugene Zemtsov <eugene@chromium.org>
> 
> Stop reading keys and return AVERROR_INVALIDDATA if key_size
> is larger than the amount of space left in the atom.
> 
> Bug: https://crbug.com/41496983
> Signed-off-by: Eugene Zemtsov <eugene@chromium.org>
> ---
>   libavformat/mov.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 662301bf67..2d92e7963b 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -5048,12 +5048,13 @@ static int mov_read_keys(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>       for (i = 1; i <= count; ++i) {
>           uint32_t key_size = avio_rb32(pb);
>           uint32_t type = avio_rl32(pb);
> -        if (key_size < 8) {
> +        if (key_size < 8 || key_size > atom.size) {
>               av_log(c->fc, AV_LOG_ERROR,
>                      "The key# %"PRIu32" in meta has invalid size:"
>                      "%"PRIu32"\n", i, key_size);
>               return AVERROR_INVALIDDATA;
>           }
> +        atom.size -= key_size;
>           key_size -= 8;
>           if (type != MKTAG('m','d','t','a')) {
>               avio_skip(pb, key_size);

Applied. Thanks.
_______________________________________________
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-02  3:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-01 23:12 Eugene Zemtsov via ffmpeg-devel
2024-04-01 23:18 ` James Almer
2024-04-02  2:28   ` Eugene Zemtsov via ffmpeg-devel
2024-04-02  2:28     ` Eugene Zemtsov via ffmpeg-devel
2024-04-02  3:18       ` James Almer [this message]

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=3b44c3e2-f421-4b65-984f-5568e9095f6b@gmail.com \
    --to=jamrial@gmail.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