tumic0 / GPXSee

GPS log file viewer and analyzer with support for GPX, TCX, KML, FIT, IGC, NMEA, SLF, SML, LOC, GPI, GeoJSON and OziExplorer files.
https://www.gpxsee.org
GNU General Public License v3.0
950 stars 130 forks source link

Segmentation fault loading opentracks kml #475

Closed bschwehn closed 1 year ago

bschwehn commented 1 year ago

gpxsee crashes with segmentation fault loading the attached KML generated by opentracks.

Output:

/home/ben/.local/share/gpxsee/DEM/S-2147483648W-2147483648.hgt: No such file or directory
[1]    1909211 segmentation fault (core dumped)  gpxsee

or with gdb:

[New Thread 0x7fff617fa6c0 (LWP 1910413)]
[Thread 0x7fff617fa6c0 (LWP 1910413) exited]
/home/ben/.local/share/gpxsee/DEM/S-2147483648W-2147483648.hgt: No such file or directory

Thread 1 "gpxsee" received signal SIGSEGV, Segmentation fault.
0x00005555555f9aa8 in ?? ()
(gdb) bt
#0  0x00005555555f9aa8 in ?? ()
#1  0x0000555555602f48 in ?? ()
#2  0x0000555555603c43 in ?? ()
#3  0x00005555555fd358 in ?? ()
#4  0x00005555555db02a in ?? ()
#5  0x00005555555d460f in ?? ()
#6  0x00005555555d7711 in ?? ()
#7  0x00007ffff67802e3 in ?? () from /usr/lib/libQt6Core.so.6
#8  0x00007ffff74c8ed7 in QAction::triggered(bool) () from /usr/lib/libQt6Gui.so.6
#9  0x00007ffff74cc339 in QAction::activate(QAction::ActionEvent) () from /usr/lib/libQt6Gui.so.6
#10 0x00007ffff7b1fc3b in ?? () from /usr/lib/libQt6Widgets.so.6
#11 0x00007ffff7b203ec in ?? () from /usr/lib/libQt6Widgets.so.6
#12 0x00007ffff79bd9d5 in QWidget::event(QEvent*) () from /usr/lib/libQt6Widgets.so.6
#13 0x00007ffff7975adc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt6Widgets.so.6
#14 0x00007ffff796e4c9 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt6Widgets.so.6
#15 0x00007ffff672a118 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt6Core.so.6
#16 0x00007ffff796ae29 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from /usr/lib/libQt6Widgets.so.6
#17 0x00007ffff79cc1f3 in ?? () from /usr/lib/libQt6Widgets.so.6
#18 0x00007ffff79ccf25 in ?? () from /usr/lib/libQt6Widgets.so.6
#19 0x00007ffff7975adc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt6Widgets.so.6

But I guess I need to build from source to make the stacktrace useful.

Version 11.11 using the archlinux package.

Please let me know if this cannot be reproduced and / or more information is required.

Thanks! opentracks.zip

bschwehn commented 1 year ago

It looks like it loads when I remove the empty trackpoints like

<when>2023-01-24T17:38:18.831+01:00</when>
<coord/>

and corresponding speed / accuracy values like

<value />

I guess the data isn't very good in this test file, but it would still be nicer if gpxsee didn't crash :)

tumic0 commented 1 year ago

The parsing of KML tracks with empty coordinates (allowed by KML specification, but unusable/invalid in GPXSee) was indeed broken. Thanks for reporting it and providing the sample data. Fixed in 51511a9bf9bcf7e0aeadc000b6fdb3956e04e477.