mbox series

[0/2] trace-cmd lib: Fix potential integer overflows

Message ID 20240911163653.12606-1-jjindrak@suse.cz (mailing list archive)
Headers show
Series trace-cmd lib: Fix potential integer overflows | expand

Message

jjindrak@suse.cz Sept. 11, 2024, 4:36 p.m. UTC
From: Jaroslav Jindrak <jjindrak@suse.cz>

There are two possible integer overflows in libtracecmd when reading
CPU data from a file. The first one can cause the size returned by
stat() to overflow when assigned from off_t to an int, which can then
lead to a the read_size and the file size not matching. The second one
occurs when printing such an error because we use %lld to print an
unsigned long long int. These two overflows can lead to a situation
such as this:

libtracecmd: Invalid argument
  did not match size of 3451486208 to -843481088

Jaroslav Jindrak (2):
  trace-cmd lib: Fix potential integer overflow in
    tracecmd_write_cpu_data()
  trace-cmd lib: Use proper printf format specifiers

 lib/trace-cmd/include/trace-cmd-local.h | 2 +-
 lib/trace-cmd/trace-output.c            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)