[FFmpeg-devel] avformat/ifv: Check for EOF in read_index()

Submitted by Michael Niedermayer on July 17, 2019, 11:42 p.m.

Details

Message ID 20190717234223.2064-1-michael@niedermayer.cc
State Accepted
Commit 00ed04d6149691a9abf486b2f88172fd6341d801
Headers show

Commit Message

Michael Niedermayer July 17, 2019, 11:42 p.m.
Fixes: Timeout
Fixes: 15567/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5758451487080448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/ifv.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Peter Ross July 18, 2019, 2:32 p.m.
On Thu, Jul 18, 2019 at 01:42:23AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 15567/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5758451487080448
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/ifv.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/ifv.c b/libavformat/ifv.c
> index 6acbb29a75..f95e9b0e52 100644
> --- a/libavformat/ifv.c
> +++ b/libavformat/ifv.c
> @@ -68,6 +68,8 @@ static int read_index(AVFormatContext *s,
>      }
>  
>      for (i = start_index; i < end_index; i++) {
> +        if (avio_feof(s->pb))
> +            return AVERROR_EOF;
>          pos = avio_rl32(s->pb);
>          size = avio_rl32(s->pb);
>  

i approve.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
Michael Niedermayer July 18, 2019, 7:59 p.m.
On Fri, Jul 19, 2019 at 12:32:06AM +1000, Peter Ross wrote:
> On Thu, Jul 18, 2019 at 01:42:23AM +0200, Michael Niedermayer wrote:
> > Fixes: Timeout
> > Fixes: 15567/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5758451487080448
> > 
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavformat/ifv.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/libavformat/ifv.c b/libavformat/ifv.c
> > index 6acbb29a75..f95e9b0e52 100644
> > --- a/libavformat/ifv.c
> > +++ b/libavformat/ifv.c
> > @@ -68,6 +68,8 @@ static int read_index(AVFormatContext *s,
> >      }
> >  
> >      for (i = start_index; i < end_index; i++) {
> > +        if (avio_feof(s->pb))
> > +            return AVERROR_EOF;
> >          pos = avio_rl32(s->pb);
> >          size = avio_rl32(s->pb);
> >  
> 
> i approve.

will apply

thanks

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/ifv.c b/libavformat/ifv.c
index 6acbb29a75..f95e9b0e52 100644
--- a/libavformat/ifv.c
+++ b/libavformat/ifv.c
@@ -68,6 +68,8 @@  static int read_index(AVFormatContext *s,
     }
 
     for (i = start_index; i < end_index; i++) {
+        if (avio_feof(s->pb))
+            return AVERROR_EOF;
         pos = avio_rl32(s->pb);
         size = avio_rl32(s->pb);