aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDale Curtis <dalecurtis@chromium.org>2013-03-26 14:12:30 -0700
committerMichael Niedermayer <michaelni@gmx.at>2013-05-09 21:01:02 +0200
commitf8d5f3dff5d665234d50d5d91085eaf8644e5ff8 (patch)
treee8046e4bbaaec314c47e4ba142038341a0a4fe80
parent298e03d1023daf4c7074e0d781b0cdd9d56d9f8f (diff)
downloadffmpeg-f8d5f3dff5d665234d50d5d91085eaf8644e5ff8.tar.gz
Fix heap-buffer-overflow in matroska_parse_block
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 81e85bc95cb1e4f8cc7b1ba71ec027c8791b55d1) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/matroskadec.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 45c1638d85..f8cd81f2ba 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1916,10 +1916,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;
@@ -2017,6 +2017,7 @@ static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf,
*buf = data;
*lace_buf = lace_size;
+ *buf_size = size;
return res;
}
@@ -2252,7 +2253,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)