aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2011-06-28 22:24:21 -0700
committerRonald S. Bultje <rsbultje@gmail.com>2011-06-29 09:45:52 -0700
commit9ed6cbc3ee2ae3e7472fb25192a7e36fd7b15533 (patch)
treed34a3f23609113cd1fabf61c3c65a15c2b870a5a /libavformat
parentef1ee362b36893cd1cc1e9c7de378e9cb239b0e8 (diff)
downloadffmpeg-9ed6cbc3ee2ae3e7472fb25192a7e36fd7b15533.tar.gz
ogg: fix double free when finding length of small chained oggs.
ogg_save() copies streams[], but doesn't keep track of free()'ed struct members. Thus, if in between a call to ogg_save() and ogg_restore(), streams[].private was free()'ed, this would result in a double free -> crash, which happened when e.g. playing small chained ogg fragments.
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/oggdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index f1ad630c5e..998a33b43c 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -238,7 +238,8 @@ static int ogg_read_page(AVFormatContext *s, int *str)
for (n = 0; n < ogg->nstreams; n++) {
av_freep(&ogg->streams[n].buf);
- av_freep(&ogg->streams[n].private);
+ if (!ogg->state || ogg->state->streams[n].private != ogg->streams[n].private)
+ av_freep(&ogg->streams[n].private);
}
ogg->curidx = -1;
ogg->nstreams = 0;