From: Mathieu Desnoyers Date: Wed, 27 Nov 2013 09:50:54 +0000 (-0500) Subject: Fix: test content size vs headers len X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;ds=sidebyside;h=a7ac9efd15a5a41c3f10358de621923099531755;p=deliverable%2Fbabeltrace.git 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 278956b85..794e428c5 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;