From 4f2b03646f48295eeb777052912dc619bcf90830 Mon Sep 17 00:00:00 2001 From: srcejon Date: Tue, 30 Apr 2024 09:32:22 +0100 Subject: [PATCH 1/2] AIS: Fix string decoding in safetey messages. #2094 --- sdrbase/util/ais.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdrbase/util/ais.cpp b/sdrbase/util/ais.cpp index 35b510936..0f282a971 100644 --- a/sdrbase/util/ais.cpp +++ b/sdrbase/util/ais.cpp @@ -502,7 +502,7 @@ AISSafetyMessage::AISSafetyMessage(QByteArray ba) : m_sequenceNumber = ba[4] & 0x3; m_destinationId = ((ba[5] & 0xff) << 22) | ((ba[6] & 0xff) << 14) | ((ba[7] & 0xff) << 6) | ((ba[8] >> 2) & 0x3f); m_retransmitFlag = (ba[8] >> 1) & 0x1; - m_safetyRelatedText = AISMessage::getString(ba, 9, 0, (ba.size() - 9) * 8 / 6); + m_safetyRelatedText = AISMessage::getString(ba, 9, 8, (ba.size() - 9) * 8 / 6); } QString AISSafetyMessage::toString() @@ -518,7 +518,7 @@ AISSafetyAck::AISSafetyAck(QByteArray ba) : AISSafetyBroadcast::AISSafetyBroadcast(QByteArray ba) : AISMessage(ba) { - m_safetyRelatedText = AISMessage::getString(ba, 5, 0, (ba.size() - 6) * 8 / 6); + m_safetyRelatedText = AISMessage::getString(ba, 5, 8, (ba.size() - 5) * 8 / 6); } QString AISSafetyBroadcast::toString() From 39760146d4b194e5b65d1451357220072f59f879 Mon Sep 17 00:00:00 2001 From: srcejon Date: Tue, 30 Apr 2024 09:33:54 +0100 Subject: [PATCH 2/2] ValueDial: Fix array being accessed out of range. --- sdrgui/gui/valuedial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdrgui/gui/valuedial.cpp b/sdrgui/gui/valuedial.cpp index 770fb824d..2f68c82ee 100644 --- a/sdrgui/gui/valuedial.cpp +++ b/sdrgui/gui/valuedial.cpp @@ -601,7 +601,7 @@ void ValueDial::keyPressEvent(QKeyEvent *value) emit changed(m_valueNew); m_cursor++; - if (m_text[m_cursor] == m_groupSeparator) { + if ((m_cursor >= 0) && (m_cursor < m_text.size()) && (m_text[m_cursor] == m_groupSeparator)) { m_cursor++; }