From bf2c7f077c6c54fb8260b02ccc21a0dd8c688faa 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 bc3137c3..20e84948 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -1569,6 +1569,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