Assert on matching channel size for duplicate channel IDs in TlmPacke…#5357
Open
Sammy-Dabbas wants to merge 1 commit into
Open
Assert on matching channel size for duplicate channel IDs in TlmPacke…#5357Sammy-Dabbas wants to merge 1 commit into
Sammy-Dabbas wants to merge 1 commit into
Conversation
…tizer TlmEntry.channelSize was overwritten each time a channel ID recurred across packets, so a channel declared with different sizes in two packets corrupted the earlier packet's buffer offsets and overflowed the fill buffer during TlmRecv/TlmGet copies. Stamp the size on the first sighting and assert equality on subsequent sightings, mirroring the duplicate-detection assert already used for the ignore list. Identical duplicates across packets are still allowed. Fixes nasa#5132.
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.
Change Description
TlmPacketizer's
setPacketListstores each channel's serialized size in a singleTlmEntry.channelSize. When the same channel ID appears in more than one packet, the loop overwrote that size with the last-seen value, so the earlier packet's buffer offsets (computed from the original size) no longer matched. The runtimememcpyinTlmRecv_handler/TlmGet_handlercould then read or write past the channel's slot and overflow the fill buffer.This stamps the size on the first sighting of a channel ID and
FW_ASSERTs that any later sighting has the same size, mirroring the duplicate detection assert already present in the ignore-list loop. Identical-definition duplicates across packets behave exactly as before; a conflicting definition trips a configuration-time assert before any buffer is used.Rationale
Fixes #5132. Per @LeStarch's clarification on the issue, a channel ID may repeat across packets as long as its definition is identical, so this allows matching duplicates and rejects only conflicting sizes.
Testing/Review Recommendations
Two unit tests added in
Svc/TlmPacketizer/test/ut:DuplicateChannelIdMatchingSizeTestconfirms an identical-size duplicate across two packets is accepted and both packets emit;DuplicateChannelIdConflictingSizeTestconfirms a conflicting size trips the assert viaASSERT_DEATH_IF_SUPPORTED. I could not build locally (no C++ toolchain), so please rely on CI for the compile and unit-test run.Future Work
None.
AI Usage (see policy)
No