bsc-performance-tools / extrae

Instrumentation framework to generate execution traces of the most used parallel runtimes.
https://tools.bsc.es/extrae
GNU Lesser General Public License v2.1
58 stars 35 forks source link

Loading of user-defined events segfaults if labels are too large #85

Closed sebastiankreutzer closed 2 months ago

sebastiankreutzer commented 11 months ago

I am working with a test case that uses user-defined events. When running mpi2prv, a call to malloc segfaults, giving the following error message:malloc(): invalid size (unsorted).

The problem stems from the Labels_loadSYMfilefunction in paraver/labels.c:785 (Extrae v4.0.4, altough previous versions have the same issue). There,strcpy(evt_value->label, value_description) is used to copy the event description into the event_value struct. However, the maximum size of value_description is 1024, while evt_value->label is only 256 bytes long (defined by VALUE_LBL in labels.h). Thus, if the read value_description is longer then 256 characters, strcpy will overflow, causing a segfault when trying to allocate the next event.

I suggest the following fix:

If this solution sounds reasonable to you, I can submit a pull request.