Commit 0e7efb9d authored by Laurent Aimar's avatar Laurent Aimar Committed by Luca Barbato

oggdec: fix out of bound write in the ogg demuxer

Between ogg_save() and ogg_restore() calls, the number of streams
could have been reduced.
Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
parent 7574cacb
......@@ -92,14 +92,24 @@ static int ogg_restore(AVFormatContext *s, int discard)
ogg->state = ost->next;
if (!discard){
struct ogg_stream *old_streams = ogg->streams;
for (i = 0; i < ogg->nstreams; i++)
av_free (ogg->streams[i].buf);
avio_seek (bc, ost->pos, SEEK_SET);
ogg->curidx = ost->curidx;
ogg->nstreams = ost->nstreams;
ogg->streams = av_realloc (ogg->streams,
ogg->nstreams * sizeof (*ogg->streams));
if (ogg->streams) {
memcpy(ogg->streams, ost->streams,
ost->nstreams * sizeof(*ogg->streams));
} else {
av_free(old_streams);
ogg->nstreams = 0;
}
}
av_free (ost);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment