Fix: source.ctf.fs: 0-length packet index length causes SIGFPE
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 1 Jun 2020 22:53:45 +0000 (18:53 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 6 Jun 2020 02:28:43 +0000 (22:28 -0400)
commitc0b480d3f3773f0b3c8a10640fdaf51eb70b5e1e
tree4b3047451fd06f9a658d13265639fdc31b80ab32
parent71d8a83780bf2ab4902ce7e3a309a635bedfba14
Fix: source.ctf.fs: 0-length packet index length causes SIGFPE

A corrupted index can present a 0-length packet index length
which will result in a division by 0 when computing the index
entry count.

Program terminated with signal SIGFPE, Arithmetic exception.
 #0  0x00007f6ecbd44978 in build_index_from_idx_file (ds_file=0x561ade51ca00, file_info=0x561ade51d000,
    msg_iter=0x561ade51cd00) at data-stream-file.c:640
640 file_entry_count = (filesize - sizeof(*header)) / file_index_entry_size;

The index packet length is checked against the smallest valid size:
the size of an index entry as of the 1.0 CTF index version.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I83c705575d55f3b56ae413d1ce5ae0fc60121f2c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3606
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/plugins/ctf/fs-src/data-stream-file.c
src/plugins/ctf/fs-src/lttng-index.h
This page took 0.024796 seconds and 4 git commands to generate.