From: Mathieu Desnoyers Date: Thu, 26 May 2011 00:20:50 +0000 (-0400) Subject: Check for files not containing any header X-Git-Tag: v0.1~15 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=8895362d406b7e7752aed90dcdfa3903910cbbbd Check for files not containing any header Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 2048d6a0..adff1eb7 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -784,6 +784,9 @@ int create_stream_packet_index(struct ctf_trace *td, if (ret < 0) return ret; + if (filestats.st_size < MAX_PACKET_HEADER_LEN / CHAR_BIT) + return -EINVAL; + for (pos->mmap_offset = 0; pos->mmap_offset < filestats.st_size; ) { uint64_t stream_id = 0;