Repository navigation
Check lengths before reading short or unexpected frames - #120
Merged
fdlamotte merged 1 commit intoNov 22, 2026
Merged
Conversation
- RX_LOG_DATA: a packet cut before its path byte, or inside its path, gets the same sentinel fields as a too-short payload instead of raising. - CUSTOM_VARS: a pair without ':' (or after a trailing ',') is skipped. - PATH_DISCOVERY_RESPONSE: a path length of 0xFF reads as no path, and a path cut short raises instead of being read short. - MSG_SENT shorter than 10 bytes is reported as invalid_frame_length instead of dispatched with a 3-byte ack and a timeout of 0. Part of meshcore-dev#119 (A1, A3, A6).
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.
What was wrong (#119, A1, A3 and A6): a few frames raised in the reader, or were read wrongly, when cut short or carrying a value it didn't expect.
IndexError, and no event was dispatched.:(gps) or a trailing comma (gps:1,) raisedIndexError, soget_custom_varswaited out its timeout.0xFFread 63 four-byte hops, then raised.expected_ackand asuggested_timeoutof 0.What changed
parsePacketPayloadgives a packet cut before its path byte, or inside its path, the same sentinel fields as the existing too-short case, so the RX_LOG_DATA event still goes out.partition(":")and skips pairs without one. A value containing:now keeps all of it.0xFFreads as no path (-1, as CONTACT'sout_path_lendoes), and a path cut short raises instead of being read short.ERRORwithreason: invalid_frame_length, as the STATS and TUNING_PARAMS length checks already do.Verified with new unit tests in
tests/unit/test_reader_frame_lengths.py. The ones for these faults fail on currentmain. The whole suite passes on 3.11 and 3.14.Part of #119.