mkv: Fix a bug where a pointer was cached to an array that might later move due to
authorChris Evans <cevans@chromium.org>
Wed, 4 Jan 2012 15:33:34 +0000 (16:33 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 4 Jan 2012 21:18:55 +0000 (22:18 +0100)
a realloc()

BUG=100492
Review URL: http://codereview.chromium.org/8366004
Fixes: 1 of 2 for CVE-2011-3893

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f35e037c93cf7d25e65b4a2ed3674358f05e4bed)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/matroskadec.c

index 4a0c2fa..c02013e 100644 (file)
@@ -1223,7 +1223,6 @@ static int matroska_parse_seekhead_entry(MatroskaDemuxContext *matroska, int idx
 static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
 {
     EbmlList *seekhead_list = &matroska->seekhead;
-    MatroskaSeekhead *seekhead = seekhead_list->elem;
     int64_t before_pos = avio_tell(matroska->ctx->pb);
     int i;
 
@@ -1233,6 +1232,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
         return;
 
     for (i = 0; i < seekhead_list->nb_elem; i++) {
+        MatroskaSeekhead *seekhead = seekhead_list->elem;
         if (seekhead[i].pos <= before_pos)
             continue;