aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDale Curtis <dalecurtis@chromium.org>2013-03-27 14:02:03 -0700
committerReinhard Tartler <siretart@tauware.de>2013-04-06 11:39:39 +0200
commitb90816d94b0b5c01f451ff98cfbf1d5ddec9c3c1 (patch)
tree7637895f6c3ff98bd32af5538aa4b57c4bc78d54
parent05015d03da1d745bb92915b5cea92dec16af719f (diff)
downloadffmpeg-b90816d94b0b5c01f451ff98cfbf1d5ddec9c3c1.tar.gz
matroska: Update the available size after lace parsing
Fix heap-buffer-overflow in matroska_parse_block for corrupted real media in mkv files. CC: libav-stable@libav.org Signed-off-by: Luca Barbato <lu_zero@gentoo.org> (cherry picked from commit fc43c19a567aa945398dccb491d972c11ec2a065) Signed-off-by: Reinhard Tartler <siretart@tauware.de>
-rw-r--r--libavformat/matroskadec.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 962493c72e..5e94b725f8 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1757,10 +1757,10 @@ static void matroska_clear_queue(MatroskaDemuxContext *matroska)
}
static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf,
- int size, int type,
+ int* buf_size, int type,
uint32_t **lace_buf, int *laces)
{
- int res = 0, n;
+ int res = 0, n, size = *buf_size;
uint8_t *data = *buf;
uint32_t *lace_size;
@@ -1858,6 +1858,7 @@ static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf,
*buf = data;
*lace_buf = lace_size;
+ *buf_size = size;
return res;
}
@@ -2052,7 +2053,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
matroska->skip_to_keyframe = 0;
}
- res = matroska_parse_laces(matroska, &data, size, (flags & 0x06) >> 1,
+ res = matroska_parse_laces(matroska, &data, &size, (flags & 0x06) >> 1,
&lace_size, &laces);
if (res)