From 56c2337004d5223ae03d08020ad3eb4faa1bebc6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20Storsj=C3=B6?= Date: Thu, 21 Nov 2013 11:53:58 +0200 Subject: [PATCH] hls: Avoid reading outside of the allocated array MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit CC: libav-stable@libav.org Signed-off-by: Martin Storsjö --- libavformat/hls.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 14fdf8f..290f12e 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -668,7 +668,8 @@ start: /* Check if this stream still is on an earlier segment number, or * has the packet with the lowest dts */ if (var->pkt.data) { - struct variant *minvar = c->variants[minvariant]; + struct variant *minvar = minvariant < 0 ? + NULL : c->variants[minvariant]; if (minvariant < 0 || var->cur_seq_no < minvar->cur_seq_no) { minvariant = i; } else if (var->cur_seq_no == minvar->cur_seq_no) { -- 2.7.4