[FFmpeg-devel] [PATCH 2/3] avformat/tty: Fix division by 0 in probe

Michael Niedermayer michaelni at gmx.at
Fri Feb 7 01:15:46 EET 2020


On Thu, Feb 06, 2020 at 03:27:11PM +0100, Paul B Mahol wrote:
> Nonsense, why would this code be called with 0 buffer?

I guess because code calls av_probe_input_format3() with a 0 buffer
its a public function and called by multiple places from our code base
as well. Theres even code in it to handle the case of a 0 sized input.

The code that triggers it in this case seems to be probing the stream
content. Its not a 0 byte input file

Thanks


> 
> On 2/6/20, Michael Niedermayer <michael at niedermayer.cc> wrote:
> > Fixes: division by zero
> > Fixes:
> > 20436/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5763229752229888
> >
> > Found-by: continuous fuzzing process
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavformat/tty.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/libavformat/tty.c b/libavformat/tty.c
> > index 60f7e9f87e..854a23c500 100644
> > --- a/libavformat/tty.c
> > +++ b/libavformat/tty.c
> > @@ -53,6 +53,9 @@ static int read_probe(const AVProbeData *p)
> >  {
> >      int cnt = 0;
> >
> > +    if (!p->buf_size)
> > +        return 0;
> > +
> >      for (int i = 0; i < p->buf_size; i++)
> >          cnt += !!isansicode(p->buf[i]);
> >
> > --
> > 2.17.1
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200207/83807e4d/attachment.sig>


More information about the ffmpeg-devel mailing list