[FFmpeg-cvslog] hls: Avoid reading outside of the allocated array

Martin Storsjö git at videolan.org
Fri Nov 22 18:28:25 CET 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Thu Nov 21 11:53:58 2013 +0200| [56c2337004d5223ae03d08020ad3eb4faa1bebc6] | committer: Martin Storsjö

hls: Avoid reading outside of the allocated array

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=56c2337004d5223ae03d08020ad3eb4faa1bebc6
---

 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 ffmpeg-cvslog mailing list