From 19f251a2882a8d0779b432e63bf282e4d9c443bb Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Thu, 28 Mar 2013 03:30:53 +0100 Subject: [PATCH 1/2] clang: use -fsantize=address and -fsanitize=thread The previous syntax is deprecated. --- configure | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 46635ce21f..10246e527f 100755 --- a/configure +++ b/configure @@ -2158,13 +2158,13 @@ sysinclude_default="${sysroot}/usr/include" case "$toolchain" in clang-asan) cc_default="clang" - add_cflags -faddress-sanitizer - add_ldflags -faddress-sanitizer + add_cflags -fsanitize=address + add_ldflags -fsanitize=address ;; clang-tsan) cc_default="clang" - add_cflags -fthread-sanitizer - add_ldflags -fthread-sanitizer + add_cflags -fsanitize=thread -pie + add_ldflags -fsanitize=thread -pie ;; msvc) cc_default="c99wrap cl" From fc43c19a567aa945398dccb491d972c11ec2a065 Mon Sep 17 00:00:00 2001 From: Dale Curtis Date: Wed, 27 Mar 2013 14:02:03 -0700 Subject: [PATCH 2/2] 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 --- libavformat/matroskadec.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 4a872b8dc8..2ec669f005 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1756,10 +1756,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; @@ -1857,6 +1857,7 @@ static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf, *buf = data; *lace_buf = lace_size; + *buf_size = size; return res; } @@ -2051,7 +2052,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)