Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v2] avformat/vqf: Propagate errors from add_metadata()
Date: Tue, 21 Jan 2025 19:02:06 +0100
Message-ID: <20250121180206.GN4991@pb2> (raw)
In-Reply-To: <Z3WPJ8oqUOp-MyZR@metallschleim.local>


[-- Attachment #1.1: Type: text/plain, Size: 2381 bytes --]

On Wed, Jan 01, 2025 at 07:53:27PM +0100, Alexander Strasser via ffmpeg-devel wrote:
> On 2025-01-01 06:15 +0100, Michael Niedermayer wrote:
> > Suggested-by: Marton Balint <cus@passwd.hu>
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavformat/vqf.c | 21 ++++++++++++++-------
> >  1 file changed, 14 insertions(+), 7 deletions(-)
> >
> > diff --git a/libavformat/vqf.c b/libavformat/vqf.c
> > index 79deb33744b..58b1546f531 100644
> > --- a/libavformat/vqf.c
> > +++ b/libavformat/vqf.c
> > @@ -51,23 +51,28 @@ static int vqf_probe(const AVProbeData *probe_packet)
> >      return AVPROBE_SCORE_EXTENSION;
> >  }
> >
> > -static void add_metadata(AVFormatContext *s, uint32_t tag,
> > +static int add_metadata(AVFormatContext *s, uint32_t tag,
> >                           unsigned int tag_len, unsigned int remaining)
> >  {
> >      int len = FFMIN(tag_len, remaining);
> >      char *buf, key[5] = {0};
> > +    int ret;
> >
> >      if (len == UINT_MAX)
> > -        return;
> > +        return AVERROR_INVALIDDATA;
> >
> >      buf = av_malloc(len+1);
> >      if (!buf)
> > -        return;
> > -    if (len != avio_read(s->pb, buf, len))
> > -        return;
> > +        return AVERROR(ENOMEM);
> > +
> > +    ret = avio_read(s->pb, buf, len);
> > +    if (ret < 0)
> > +        return ret;
> > +    if (len != ret)
> > +        return AVERROR_INVALIDDATA;
> >      buf[len] = 0;
> >      AV_WL32(key, tag);
> > -    av_dict_set(&s->metadata, key, buf, AV_DICT_DONT_STRDUP_VAL);
> > +    return av_dict_set(&s->metadata, key, buf, AV_DICT_DONT_STRDUP_VAL);
> >  }
> >
> >  static const AVMetadataConv vqf_metadata_conv[] = {
> > @@ -165,7 +170,9 @@ static int vqf_read_header(AVFormatContext *s)
> >              avio_skip(s->pb, FFMIN(len, header_size));
> >              break;
> >          default:
> > -            add_metadata(s, chunk_tag, len, header_size);
> > +            ret = add_metadata(s, chunk_tag, len, header_size);
> > +            if (ret < 0)
> > +                return ret;
> >              break;
> >          }
> >
> > --
> 
> LGTM regarding my review comments.

will apply

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct answer.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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:[~2025-01-21 18:02 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <Z3WPJ8oqUOp-MyZR@metallschleim.local>]

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=20250121180206.GN4991@pb2 \
    --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