From a92a7ddc253a640aba974d859eab20d74cebb3e0 Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Tue, 12 Apr 2011 00:19:56 +0300 Subject: applehttp: Only check the discard flags if v->ctx actually is initialized MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This code could be executed if the demuxer reads more than one segment before returning from av_open_input_stream. Signed-off-by: Martin Storsjö --- libavformat/applehttp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libavformat') diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 243f4a6a03..35759be3cb 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -309,10 +309,13 @@ reload: c->end_of_segment = 1; c->cur_seq_no = v->cur_seq_no; - v->needed = 0; - for (i = v->stream_offset; i < v->stream_offset + v->ctx->nb_streams; i++) { - if (v->parent->streams[i]->discard < AVDISCARD_ALL) - v->needed = 1; + if (v->ctx) { + v->needed = 0; + for (i = v->stream_offset; i < v->stream_offset + v->ctx->nb_streams; + i++) { + if (v->parent->streams[i]->discard < AVDISCARD_ALL) + v->needed = 1; + } } if (!v->needed) { av_log(v->parent, AV_LOG_INFO, "No longer receiving variant %d\n", -- cgit v1.2.3