[FFmpeg-devel] [PATCH] avformat/oggenc: check for stream private data in ogg_free()

James Almer jamrial at gmail.com
Thu Jun 22 21:55:57 EEST 2017


Fixes a NULL pointer derefence when ogg_init() returns a failure and
a stream's private data was not yet allocated.

This is a regression since 3c5a53cdfa099bba8bd951f95b85727b4b3b5d68

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/oggenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 7c1115afd6..10c4eda062 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -743,6 +743,8 @@ static void ogg_free(AVFormatContext *s)
     for (i = 0; i < s->nb_streams; i++) {
         AVStream *st = s->streams[i];
         OGGStreamContext *oggstream = st->priv_data;
+        if (!oggstream)
+            continue;
         if (st->codecpar->codec_id == AV_CODEC_ID_FLAC ||
             st->codecpar->codec_id == AV_CODEC_ID_SPEEX ||
             st->codecpar->codec_id == AV_CODEC_ID_OPUS ||
-- 
2.13.0



More information about the ffmpeg-devel mailing list