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 <c...@passwd.hu>
> > Signed-off-by: Michael Niedermayer <mich...@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: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to