Guard against empty containers in ARRL Digi decode path (Qt6 crash) - #51
Open
cjkjellander wants to merge 1 commit into
Open
Guard against empty containers in ARRL Digi decode path (Qt6 crash)#51cjkjellander wants to merge 1 commit into
cjkjellander wants to merge 1 commit into
Conversation
The ARRL Digital contest feature indexes several containers with the
unchecked operator[] while processing decodes in readFromStdout(),
which segfaults under Qt6 (Qt5's QByteRef/QList tolerated it):
- activeWorked(): m_activeCall[call].bands is empty when the callsign
was never seeded via ARRL_Digi_Update(), so ba[3]='d' (and the other
band slots) write past the end of the QByteArray.
- ARRL_Digi_Update(): dt.messageWords()[0] indexes an empty QStringList
for a decode that yields no words.
- readFromStdout(): word[0] indexes the result of
split(" ", SkipEmptyParts), which can be empty.
Add isEmpty()/size() guards at each site. These paths only execute in
ARRL_DIGI special-operating mode, which is why they went unnoticed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The ARRL Digital contest feature (
SpecOp::ARRL_DIGI) indexes severalcontainers with the unchecked
operator[]while processing decodes inMainWindow::readFromStdout(). When a decode yields an empty result thesebecome out-of-bounds accesses. Under Qt6 (unlike Qt5's tolerant
QByteRef/QList) they dereference invalid memory and segfault.Three sites, all reached only in ARRL_DIGI mode (hence rarely hit):
MainWindow::activeWorked()—m_activeCall[call].bandsis empty whenthe callsign was never seeded (a default-constructed map entry), so
ba[0..6]=...writes past the end of theQByteArray.MainWindow::ARRL_Digi_Update()—dt.messageWords()[0]indexes anempty
QStringListfor a decode with no words, then.left(3)reads garbage.MainWindow::readFromStdout()—word[0]indexes the result ofsplit(" ", SkipEmptyParts), which can be empty.Each site gets an
isEmpty()/size()guard; behavior is unchanged when thecontainers are populated.
Found via gdb backtraces on a Qt6
RelWithDebInfobuild while decoding FT8 inARRL_DIGI mode — the crash reproduces reliably once
jt9produces decodes.