diff mbox

[FFmpeg-devel,6/8] avformat/vividas: Fix another infinite loop

Message ID 20190810210949.1743-6-michael@niedermayer.cc
State Accepted
Commit 1d72b5d2d5225dde0662a1f2083a27f86a8fdb98
Headers show

Commit Message

Michael Niedermayer Aug. 10, 2019, 9:09 p.m. UTC
Not found by the fuzzer

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/vividas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul B Mahol Aug. 11, 2019, 9:04 a.m. UTC | #1
On Sat, Aug 10, 2019 at 11:17 PM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> Not found by the fuzzer
>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/vividas.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/vividas.c b/libavformat/vividas.c
> index a5f33181de..0c33ca2da8 100644
> --- a/libavformat/vividas.c
> +++ b/libavformat/vividas.c
> @@ -546,7 +546,7 @@ static int viv_read_header(AVFormatContext *s)
>              break;
>
>          block_len = ffio_read_varlen(pb);
> -        if (avio_feof(pb))
> +        if (avio_feof(pb) || block_len <= 0)
>              return AVERROR_INVALIDDATA;
>
>
LGTM


>          block_type = avio_r8(pb);
> --
> 2.22.0
>
> _______________________________________________
> 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".
Michael Niedermayer Aug. 11, 2019, 3:15 p.m. UTC | #2
On Sun, Aug 11, 2019 at 11:04:12AM +0200, Paul B Mahol wrote:
> On Sat, Aug 10, 2019 at 11:17 PM Michael Niedermayer <michael@niedermayer.cc>
> wrote:
> 
> > Not found by the fuzzer
> >
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavformat/vividas.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavformat/vividas.c b/libavformat/vividas.c
> > index a5f33181de..0c33ca2da8 100644
> > --- a/libavformat/vividas.c
> > +++ b/libavformat/vividas.c
> > @@ -546,7 +546,7 @@ static int viv_read_header(AVFormatContext *s)
> >              break;
> >
> >          block_len = ffio_read_varlen(pb);
> > -        if (avio_feof(pb))
> > +        if (avio_feof(pb) || block_len <= 0)
> >              return AVERROR_INVALIDDATA;
> >
> >
> LGTM

will apply

thx

[...]
diff mbox

Patch

diff --git a/libavformat/vividas.c b/libavformat/vividas.c
index a5f33181de..0c33ca2da8 100644
--- a/libavformat/vividas.c
+++ b/libavformat/vividas.c
@@ -546,7 +546,7 @@  static int viv_read_header(AVFormatContext *s)
             break;
 
         block_len = ffio_read_varlen(pb);
-        if (avio_feof(pb))
+        if (avio_feof(pb) || block_len <= 0)
             return AVERROR_INVALIDDATA;
 
         block_type = avio_r8(pb);