From: Mathieu Desnoyers Date: Wed, 27 Nov 2013 09:50:54 +0000 (-0500) Subject: Fix: test content size vs headers len X-Git-Tag: v1.2.0-rc1~39^2~8 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=a7ac9efd15a5a41c3f10358de621923099531755 Fix: test content size vs headers len Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 278956b8..794e428c 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -1572,6 +1572,11 @@ begin: return -EINVAL; } + if (packet_index.content_size < pos->offset) { + fprintf(stderr, "[error] Invalid CTF stream: content size is smaller than packet headers.\n"); + return -EINVAL; + } + if ((packet_index.packet_size >> LOG2_CHAR_BIT) == 0) { fprintf(stderr, "[error] Invalid CTF stream: packet size needs to be at least one byte\n"); return -EINVAL;