summaryrefslogtreecommitdiff
path: root/libavformat/hls.c
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2015-02-16 19:31:42 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-16 19:59:04 +0100
commit4bf3fab2811509a4f9ca932191e9bfa801ceeae2 (patch)
treeb73e37a1d7d35608de251f645c43df9a9a847524 /libavformat/hls.c
parentbf9906808992d675ddcbd45cddeff7756fa3dd26 (diff)
hls: fix a null pointer dereference
Not allocating the pls->ctx will crash in libavformat/hls.c:1410, where it tries to dereference the field. Sample: http://ec24.rtp.pt/liverepeater/rtpn.smil/playlist.m3u8 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/hls.c')
-rw-r--r--libavformat/hls.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/hls.c b/libavformat/hls.c
index f17b826f30..4fdda3408c 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1313,14 +1313,14 @@ static int hls_read_header(AVFormatContext *s)
struct playlist *pls = c->playlists[i];
AVInputFormat *in_fmt = NULL;
- if (pls->n_segments == 0)
- continue;
-
if (!(pls->ctx = avformat_alloc_context())) {
ret = AVERROR(ENOMEM);
goto fail;
}
+ if (pls->n_segments == 0)
+ continue;
+
pls->index = i;
pls->needed = 1;
pls->parent = s;