[FFmpeg-devel] [PATCH] libavformat/asfdec: Fix regression bug when reading image attachments

Soft Works softworkz at hotmail.com
Sun Aug 8 02:45:29 EEST 2021


> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> Carl Eugen Hoyos
> Sent: Sunday, 8 August 2021 01:33
> To: FFmpeg development discussions and patches <ffmpeg-
> devel at ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] libavformat/asfdec: Fix regression bug
> when reading image attachments
> 
> Am So., 8. Aug. 2021 um 01:26 Uhr schrieb Soft Works
> <softworkz at hotmail.com>:
> >
> > Commit c8140fe7324f264faacf7395b27e12531d1f13f7 had introduced a
> check for value_len > UINT16_MAX.
> > As a consequence, attached images of sizes larger than UINT16_MAX could
> no longer be read.
> >
> > Signed-off-by: softworkz <softworkz at hotmail.com>
> > ---
> >  libavformat/asfdec_f.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index
> > f784e62996..708331637e 100644
> > --- a/libavformat/asfdec_f.c
> > +++ b/libavformat/asfdec_f.c
> > @@ -707,7 +707,8 @@ static int asf_read_metadata(AVFormatContext *s,
> > int64_t size)  {
> >      AVIOContext *pb = s->pb;
> >      ASFContext *asf = s->priv_data;
> > -    int n, stream_num, name_len_utf16, name_len_utf8, value_len;
> > +    int n, stream_num, name_len_utf16, name_len_utf8;
> > +       unsigned int value_len;
> 
> There is something wrong with the indentation afaict.

You're right, wrong IDE setting. Thanks.

> And why can't you fix the issue leaving the variable an int?

Why use an int variable to take the value of a function that 
returns uint and afterwards check whether it's negative?
Why use int type for size values at all?

I didn't want to make a bigger thing out of the fix, though.

softworkz


More information about the ffmpeg-devel mailing list