Project

General

Profile

Actions

Bug #450

closed

Can't open trace files smaller than the page size

Added by Simon Marchi almost 12 years ago. Updated over 11 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
02/18/2013
Due date:
% Done:

0%

Estimated time:

Description

I have a simple trace containing two files:
  • metadata
  • stream

When the "stream" file (actual trace data) is smaller than a page size, babeltrace can't read it.

I attached a sample trace. I believe with all my heart that it is a valid trace.


Files

outtrace.tgz (923 Bytes) outtrace.tgz Sample trace Simon Marchi, 02/18/2013 04:11 PM
Actions #1

Updated by Simon Marchi almost 12 years ago

Pointer in the code, open fails at this check: if (filestats.st_size < MAX_PACKET_HEADER_LEN / CHAR_BIT)

http://git.efficios.com/?p=babeltrace.git;a=blob;f=formats/ctf/ctf.c;h=5a5149572f76fd3cf2210766700a98a28575e482;hb=HEAD#l1283

Actions #2

Updated by Mathieu Desnoyers almost 12 years ago

fixing this imply a couple of things:

1) removing the check:

if (filestats.st_size < MAX_PACKET_HEADER_LEN / CHAR_BIT)
return -EINVAL;

(easy part)

2) adding checks at each step of create_stream_packet_index() that ensures we have the expected amount of data required to read the header fields available within the file. Basically, we need to always gracefully handle an oddly-formed file (even corner-cases designed to crash or exploit babeltrace maliciously).

(this is the hard part)

Actions #3

Updated by Mathieu Desnoyers over 11 years ago

  • Status changed from New to Resolved

commit b620ec4a9bee4f2df11d5108e73077804cfa3c85
Author: Mathieu Desnoyers <>
Date: Mon Apr 8 08:36:44 2013 -0400

Add smalltrace succeed/fail test cases
Signed-off-by: Mathieu Desnoyers &lt;&gt;

commit ec32346491f3e11fbc802a04f7dfd3259e6a8b17
Author: Mathieu Desnoyers <>
Date: Mon Apr 8 08:35:20 2013 -0400

Support packets and trace files smaller than page size
Fixes #450
Signed-off-by: Mathieu Desnoyers &lt;&gt;
Actions

Also available in: Atom PDF