berthubert / galmon

galileo open source monitoring
GNU General Public License v3.0
198 stars 53 forks source link

Crash on some Beidou message(s) #160

Open alinsavix opened 1 year ago

alinsavix commented 1 year ago

With a self-compiled galmon (from rev d326191), I get a crash in Beidou message handling after a few seconds of operation. I'm running it against an F9T (L1/L5 version) which is configured to output... er... a lot of messages. Debug output isn't particularly enformative, but the crash looks like this:

# executed with: ubxtool --wait --port /tmp/f9t  --baud 9600 --gps --galileo --glonass --beidou --sbas --destination submit.galmon.eu --station XXX --owner YYY --fuzz-position 1000 --debug
CRC mismatch, 788605 != 5686309
Fri, 04 Nov 2022 22:54:22 +0000 Had CRC mismatch!
CRC mismatch, 13247242 != 5713118
Fri, 04 Nov 2022 22:54:22 +0000 Had CRC mismatch!
CRC mismatch, 14647759 != 5643753
Fri, 04 Nov 2022 22:54:22 +0000 Had CRC mismatch!
CRC mismatch, 2094034 != 5893678
Fri, 04 Nov 2022 22:54:22 +0000 Had CRC mismatch!
CRC mismatch, 4397828 != 5737340
Fri, 04 Nov 2022 22:54:22 +0000 Had CRC mismatch!
CRC mismatch, 3597930 != 5954936
Fri, 04 Nov 2022 22:54:22 +0000 Had CRC mismatch!
CRC mismatch, 10979840 != 5353655
Fri, 04 Nov 2022 22:54:22 +0000 Had CRC mismatch!
terminate called after throwing an instance of 'std::runtime_error'
  what():  Beidou checksum error chunk0

And the stack is mostly just the exception handling, but looks like:

(gdb) bt
#0  0x00007ffff6a42387 in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:55
#1  0x00007ffff6a43a78 in __GI_abort () at abort.c:90
#2  0x00007ffff756ea95 in __gnu_cxx::__verbose_terminate_handler ()
    at ../../../../libstdc++-v3/libsupc++/vterminate.cc:95
#3  0x00007ffff756ca06 in __cxxabiv1::__terminate (handler=<optimized out>)
    at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:38
#4  0x00007ffff756ca33 in std::terminate ()
    at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:48
#5  0x00007ffff756cc53 in __cxxabiv1::__cxa_throw (obj=0x5923a0,
    tinfo=0x585700 <typeinfo for std::runtime_error@GLIBCXX_3.4>,
    dest=0x40bd10 <std::runtime_error::~runtime_error()@plt>)
    at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:87
#6  0x00000000004cef42 in getCondensedBeidouMessage (payload="\270\252w\200m\303\300\026\250\300\001D\200\001\277\td\227\377\251\020\235\\\335|\001\277K5\376\227\277\234u\300]") at beidou.cc:40
#7  0x000000000044f132 in main (argc=20, argv=0x7fffffffe548)
    at ubxtool.cc:1492

I'm guessing the error isn't getting caught and thus causing a crash, but I haven't looked that deeply. I'm assuming that the payload string there is all that's needed to understand what's going on (since that's really the only thing getCondensedBeidouMessage touches), so original ubx packet not included (mostly because I'm not sure how to isolate which specific packet is causing the issue -- suggestions welcome!)

Given how quickly this happens, and given the other CRC messages that start to appear immediately, I'm going to guess that there's a problem with galmon's Beidou message handling, rather than there being an error with receipt of the messages themselves.

Happy to provide any additional information needed, just let me know what you need!