[FFmpeg-devel] [PATCH 7/8] avformat/hlsenc: check for null context to avoid uninitialized pointer access

vdixit at akamai.com vdixit at akamai.com
Fri Mar 30 08:09:01 EEST 2018


From: Vishwanath Dixit <vdixit at akamai.com>

Under error conditions, when the context is null, the application crashes
without this check.
---
 libavformat/hlsenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 1dd196f..334720f 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2318,7 +2318,8 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
     }
 
     vs->packets_written++;
-    ret = ff_write_chained(oc, stream_index, pkt, s, 0);
+    if (oc->pb)
+        ret = ff_write_chained(oc, stream_index, pkt, s, 0);
 
     return ret;
 }
-- 
1.9.1



More information about the ffmpeg-devel mailing list