[FFmpeg-cvslog] avformat/oggparsecelt: Do not re-allocate os->private

Michael Niedermayer git at videolan.org
Tue Aug 1 15:45:03 EEST 2017


ffmpeg | branch: release/3.1 | Michael Niedermayer <michael at niedermayer.cc> | Tue Jul 25 03:19:07 2017 +0200| [65304d33a20f0d88bcc526ac01e5299c88cff566] | committer: Michael Niedermayer

avformat/oggparsecelt: Do not re-allocate os->private

Fixes: double free
Fixes: clusterfuzz-testcase-minimized-5080550145785856

Found-by: ClusterFuzz
Reviewed-by: Nicolas George <george at nsup.org>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 7140761481e4296723a592019a0244ebe6c1a8cf)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=65304d33a20f0d88bcc526ac01e5299c88cff566
---

 libavformat/oggparsecelt.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavformat/oggparsecelt.c b/libavformat/oggparsecelt.c
index 6d567f988a..9c438a096a 100644
--- a/libavformat/oggparsecelt.c
+++ b/libavformat/oggparsecelt.c
@@ -65,9 +65,14 @@ static int celt_header(AVFormatContext *s, int idx)
         st->codecpar->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->codecpar->extradata + 0, overlap);
         AV_WL32(st->codecpar->extradata + 4, version);
         return 1;



More information about the ffmpeg-cvslog mailing list