]> git.sesse.net Git - ffmpeg/commitdiff
matroska: pass the lace size to the matroska_parse_rm_audio
authorLuca Barbato <lu_zero@gentoo.org>
Fri, 29 Mar 2013 11:51:51 +0000 (12:51 +0100)
committerLuca Barbato <lu_zero@gentoo.org>
Wed, 3 Apr 2013 10:34:38 +0000 (12:34 +0200)
Each lace must be independent according to the specification.

Fix heap-buffer-overflow in matroska_parse_block for
corrupted real media in mkv files.

Stricter check than fc43c19a567aa945398dccb491d972c11ec2a065

CC: libav-stable@libav.org
libavformat/matroskadec.c

index 67a3308d7d5c38a1b9ebf0c485338ba85737449d..5279110312369b1d7740aebef1c9ed1888dc7c68 100644 (file)
@@ -2080,7 +2080,8 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
              st->codec->codec_id == AV_CODEC_ID_ATRAC3) &&
              st->codec->block_align && track->audio.sub_packet_size) {
 
-            res = matroska_parse_rm_audio(matroska, track, st, data, size,
+            res = matroska_parse_rm_audio(matroska, track, st, data,
+                                          lace_size[n],
                                           timecode, duration, pos);
             if (res)
                 goto end;
@@ -2096,7 +2097,6 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
         if (timecode != AV_NOPTS_VALUE)
             timecode = duration ? timecode + duration : AV_NOPTS_VALUE;
         data += lace_size[n];
-        size -= lace_size[n];
     }
 
 end: