* Re: [FFmpeg-devel] [PATCH v2] avformat/vqf: Propagate errors from add_metadata()
[not found] ` <Z3WPJ8oqUOp-MyZR@metallschleim.local>
@ 2025-01-21 18:02 ` Michael Niedermayer
0 siblings, 0 replies; only message in thread
From: Michael Niedermayer @ 2025-01-21 18:02 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- 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".
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-01-21 18:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20250101051505.1660885-1-michael@niedermayer.cc>
[not found] ` <Z3WPJ8oqUOp-MyZR@metallschleim.local>
2025-01-21 18:02 ` [FFmpeg-devel] [PATCH v2] avformat/vqf: Propagate errors from add_metadata() Michael Niedermayer
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