[libav-stable] hls: Avoid reading outside of the allocated array

Martin Storsjö git at libav.org
Fri Nov 22 13:30:48 CET 2013


Module: libav
Branch: master
Commit: 56c2337004d5223ae03d08020ad3eb4faa1bebc6

Author:    Martin Storsjö <martin at martin.st>
Committer: Martin Storsjö <martin at martin.st>
Date:      Thu Nov 21 11:53:58 2013 +0200

hls: Avoid reading outside of the allocated array

CC: libav-stable at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>

---

 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) {



More information about the libav-stable mailing list