From a7ac9efd15a5a41c3f10358de621923099531755 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 27 Nov 2013 04:50:54 -0500 Subject: [PATCH] Fix: test content size vs headers len Signed-off-by: Mathieu Desnoyers --- formats/ctf/ctf.c | 5 +++++ 1 file changed, 5 insertions(+) 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; -- 2.34.1