Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when loading a .csv file with an empty field in AIS Demodulator #2125

Closed
dforsi opened this issue May 25, 2024 · 0 comments · Fixed by #2180
Closed

Crash when loading a .csv file with an empty field in AIS Demodulator #2125

dforsi opened this issue May 25, 2024 · 0 comments · Fixed by #2180
Assignees

Comments

@dforsi
Copy link
Contributor

dforsi commented May 25, 2024

Trying to load the attached csv file in an AIS Demodulator when using ASAN causes a SIGABRT

2024-05-25 23:00:03.488 (F) ASSERT: "uint(i) < uint(size())" in file /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h, line 502

because the ba array is empty, so ba[0] doesn't exist in this piece of code:

AISMessage* AISMessage::decode(const QByteArray ba)
{
    int id = (ba[0] >> 2) & 0x3f;

This is the backtrace:

(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1  0x00007ffff16a6b7f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  0x00007ffff16584e2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff16414ed in __GI_abort () at ./stdlib/abort.c:79
#4  0x00007ffff7eda234 in qtwebapp::Logger::msgHandler(QtMsgType, QString const&, QString const&, QString const&, int) (type=QtFatalMsg, message=..., file=..., function=..., line=502) at /home/sdrangel/logging/logger.cpp:70
#5  0x00007ffff7eda45c in qtwebapp::Logger::msgHandler5(QtMsgType, QMessageLogContext const&, QString const&) (type=QtFatalMsg, context=..., message=...) at /home/sdrangel/logging/logger.cpp:81
#6  0x00007ffff1cd26b0 in  () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007ffff1cd27c8 in  () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007ffff1c910ba in QMessageLogger::fatal(char const*, ...) const () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#9  0x00007ffff1c902ca in qt_assert_x(char const*, char const*, char const*, int) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#10 0x00007ffff4c445d3 in QByteArray::operator[](int) const (this=0x7fffec923a60, i=0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:502
#11 0x00007ffff4c48f55 in AISMessage::decode(QByteArray) (ba=...) at /home/sdrangel/sdrbase/util/ais.cpp:182
#12 0x00007fffc6b87ce5 in AISDemodGUI::messageReceived(QByteArray const&, QDateTime const&, int, int) (this=0x519000772980, message=..., dateTime=..., slot=1658, totalSlots=1) at /home/sdrangel/plugins/channelrx/demodais/aisdemodgui.cpp:424
#13 0x00007fffc6b94443 in AISDemodGUI::on_logOpen_clicked() (this=0x519000772980) at /home/sdrangel/plugins/channelrx/demodais/aisdemodgui.cpp:1048
#14 0x00007fffc6ba11ab in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (AISDemodGUI::*)()>::call(void (AISDemodGUI::*)(), AISDemodGUI*, void**)
    (f=(void (AISDemodGUI::*)(class AISDemodGUI * const)) 0x7fffc6b93382 <AISDemodGUI::on_logOpen_clicked()>, o=0x519000772980, arg=0x7fffffffc3d0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:152
#15 0x00007fffc6b9fb55 in QtPrivate::FunctionPointer<void (AISDemodGUI::*)()>::call<QtPrivate::List<>, void>(void (AISDemodGUI::*)(), AISDemodGUI*, void**)
    (f=(void (AISDemodGUI::*)(class AISDemodGUI * const)) 0x7fffc6b93382 <AISDemodGUI::on_logOpen_clicked()>, o=0x519000772980, arg=0x7fffffffc3d0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:185
#16 0x00007fffc6b9e8ec in QtPrivate::QSlotObject<void (AISDemodGUI::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x503000bdc910, r=0x519000772980, a=0x7fffffffc3d0, ret=0x0)
    at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:418
#17 0x00007ffff1f062b2 in  () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007ffff2c56d66 in QAbstractButton::clicked(bool) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#19 0x00007ffff2c56fde in  () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#20 0x00007ffff2c58bbb in  () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#21 0x00007ffff2c58ddb in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#22 0x00007ffff2d55b3e in QToolButton::mouseReleaseEvent(QMouseEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#23 0x00007ffff2ba5dc8 in QWidget::event(QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#24 0x00007ffff2b62f32 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#25 0x00007ffff2b6b45d in QApplication::notify(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#26 0x00007ffff1ecc748 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#27 0x00007ffff2b69762 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#28 0x00007ffff2bbf001 in  () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#29 0x00007ffff2bc238f in  () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#30 0x00007ffff2b62f32 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#31 0x00007ffff1ecc748 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#32 0x00007ffff233f7db in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /lib/x86_64-linux-gnu/libQt5Gui.so.5
#33 0x00007ffff23131ec in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt5Gui.so.5
#34 0x00007fffeb4fa15e in  () at /lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#35 0x00007ffff0f0de1f in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#36 0x00007ffff0f0fea7 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#37 0x00007ffff0f104c0 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#38 0x00007ffff1f27d4a in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#39 0x00007ffff1ecb0fb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#40 0x00007ffff1ed38a4 in QCoreApplication::exec() () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#41 0x000055555555ec0b in runQtApplication(int, char**, qtwebapp::LoggerWithFile*) (argc=1, argv=0x7fffffffdb78, logger=0x50700002cbe0) at /home/sdrangel/app/main.cpp:211
#42 0x000055555555f4a4 in main(int, char**) (argc=1, argv=0x7fffffffdb78) at /home/sdrangel/app/main.cpp:248

ais-demodulator-segfault.csv

@dforsi dforsi changed the title Segfault loading a .csv file with an empty field in AIS Demodulator Crash when loading a .csv file with an empty field in AIS Demodulator May 25, 2024
@srcejon srcejon self-assigned this May 26, 2024
@f4exb f4exb closed this as completed in 1625c42 Jun 20, 2024
f4exb added a commit that referenced this issue Jun 20, 2024
AIS: Validate message length. Fixes #2125
dforsi pushed a commit to dforsi/sdrangel that referenced this issue Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants