sigviewer
sigviewer copied to clipboard
Unsupported .hea file crashes when scrolling to the end
When viewing a large signal, zooming out, and scrolling to end of the signal, sigviewer crashes at signal_graphics_item.cpp line 238 because of accessing memory at address 0.
The values of the local variables at the time of crash are:
channel_overlapping false bool clip 699.0x389.0+89394477.0+0.0 QRectF data_block (null) QSharedPointer<sigviewer::DataBlock const> last_x 89394466.5 double last_y 0 sigviewer::float64 length 1418 unsigned int new_y 6.9533484305045863e-310 sigviewer::float64 option @0xcf95a8 QStyleOptionGraphicsItem painter @0x7fffffffca90 QPainter pixel_per_sample 0.5 double start_sample 178788933 unsigned int this @0x10977b0 sigviewer::SignalGraphicsItem
The number of samples in the signal is 178790349.
I fixed it by adding the line:
if (data_block == NULL) return;
after line 234 ( ... data_block = ... )
Hm. I can't reproduce this, but maybe because I don't have a large enough file. Does this also occur with shorter files? My test file had 1018 seconds times 256Hz (so roughly 260,000 samples). @Yida-Lin, can you reproduce this by any chance?
It does not happen with shorter files and it happens only after zooming out before scrolling to the end. Here is a link to the dataset I used:
https://www.dropbox.com/sh/z4wpz9hjyxd96ip/AACoN9n6Ls73hC1ZGdGUdQ2wa?dl=0
Thanks for sharing this file. A couple of things:
- It could be an issue specific to this format (.dat/.hea are not officially supported). It would be interesting to see if this behavior occurs with a file of similar contents but in a different format (e.g. GDF).
- SigViewer always crashes when scrolling to the end, independent of the zoom level.
- The time labels on the x axis disappears after a specific length (depending on the zoom level). It looks like the data type that holds the labels might be too small (such as an int16).
- I can confirm that adding an if-statement solves this issue, but this is only a workaround (since scrolling past the end shouldn't be possible at all).
@tombru79 do you have an idea what's going on?