[FFmpeg-devel] [PATCH 1/3] avformat/oggdec: Initialize return value from ogg_read_page() and check it everywhere
Michael Niedermayer
michael at niedermayer.cc
Sun Jun 7 00:30:33 EEST 2020
On Sat, Jun 06, 2020 at 09:01:44PM +0200, Lynne wrote:
> Jun 6, 2020, 19:08 by michael at niedermayer.cc:
>
> > Fixes regression since 9ad47762c17d2c6d06595aa17b88112baa91b72c
> > Fixes: out of array access
> > Fixes: 22172/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5658535590625280
> >
> > 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/oggdec.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
> > index b4ba00df61..f65013f55e 100644
> > --- a/libavformat/oggdec.c
> > +++ b/libavformat/oggdec.c
> > @@ -412,6 +412,7 @@ static int ogg_read_page(AVFormatContext *s, int *sid, int probing)
> > if (idx < 0)
> > av_free(readout_buf);
> > avio_seek(bc, start_pos, SEEK_SET);
> > + *sid = -1;
> > return 0;
> > }
> >
> > @@ -422,6 +423,7 @@ static int ogg_read_page(AVFormatContext *s, int *sid, int probing)
> > if (idx < 0)
> > av_free(readout_buf);
> > avio_seek(bc, start_pos, SEEK_SET);
> > + *sid = -1;
> > return 0;
> > }
> >
> > @@ -661,7 +663,7 @@ static int ogg_get_length(AVFormatContext *s)
> > ogg->page_pos = -1;
> >
> > while (!ogg_read_page(s, &i, 1)) {
> > - if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
> > + if (i >= 0 && ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
> > ogg->streams[i].codec) {
> > s->streams[i]->duration =
> > ogg_gptopts(s, i, ogg->streams[i].granule, NULL);
> >
>
> Took me a while to analyze.
> LGTM.
will apply
thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200606/2e1929b1/attachment.sig>
More information about the ffmpeg-devel
mailing list