diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-07-25 04:19:07 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-07-26 01:22:55 +0300 |
commit | 490b6599bbf4949b26b30c6ccd186585ff3a1510 (patch) | |
tree | d3dc5fe884baff17691262956f8281509446ada4 | |
parent | 91442fdc1c6e5276095d04e0a59f690b11af4029 (diff) |
avformat/oggparsecelt: Do not re-allocate os->private
Fixes: double free
Fixes: clusterfuzz-testcase-minimized-5080550145785856
Found-by: ClusterFuzz
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7140761481e4296723a592019a0244ebe6c1a8cf)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/oggparsecelt.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavformat/oggparsecelt.c b/libavformat/oggparsecelt.c index 2c0c511c7b..6880314055 100644 --- a/libavformat/oggparsecelt.c +++ b/libavformat/oggparsecelt.c @@ -65,9 +65,14 @@ static int celt_header(AVFormatContext *s, int idx) st->codec->channels = nb_channels; if (sample_rate) avpriv_set_pts_info(st, 64, 1, sample_rate); - priv->extra_headers_left = 1 + extra_headers; - av_free(os->private); + + if (os->private) { + av_free(priv); + priv = os->private; + } os->private = priv; + priv->extra_headers_left = 1 + extra_headers; + AV_WL32(st->codec->extradata + 0, overlap); AV_WL32(st->codec->extradata + 4, version); return 1; |