Repository navigation
Handle descriptor-only file packets as off-nominal input - #2
Closed
bitWarrior wants to merge 1 commit into
Closed
bitWarrior wants to merge 1 commit into
bitWarrior wants to merge 1 commit into
Conversation
A file packet consisting of only the FW_PACKET_FILE descriptor with no body passed the minimum-size guards in FileUplink and CfdpManager, which then built a zero-length buffer over a valid pointer. Since the LinearBufferBase refactor, its constructor required a null pointer whenever capacity is zero, so this input tripped an assertion instead of being reported as a decode error. - Fw/Types: LinearBufferBase accepts a valid pointer with zero capacity, matching ExternalSerializeBuffer::setExtBuffer and prior behavior. A null pointer with nonzero capacity still asserts. - Svc/FileUplink: reject packets that carry no bytes after the descriptor, logging InvalidPacketReceived as for shorter packets. - Svc/Ccsds/CfdpManager: same boundary check on dataIn. Tests cover zero-capacity buffers at the Fw/Types level and 1-, 2- and 3-byte packets for both components. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Owner
Author
|
Retargeting this to nasa/fprime. |
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.
Summary
Resolves an off-nominal condition in file packet ingest. A packet consisting of only the 2-byte
FW_PACKET_FILEdescriptor with no body passed the minimum-size guards inFileUplinkandCfdpManager, which then built a zero-lengthFw::Bufferover a valid pointer. Since theLinearBufferBaserefactor, its constructor required a null pointer whenever capacity is zero, so this input tripped an assertion rather than being reported as a decode error.Changes
LinearBufferBasenow accepts a valid pointer with zero capacity. This matches the existing contract ofExternalSerializeBuffer::setExtBufferand restores the behavior from before the refactor. A null pointer with nonzero capacity still asserts.InvalidPacketReceivedas it does for shorter packets.dataIn, returning the buffer silently as the existing too-small path does.The constructor change is the root fix. The two guard changes are defense in depth so neither component depends on the buffer contract for this case.
Tests
Fw_Types_ut_exe: zero-capacityExternalSerializeBufferandSerialBufferover a valid pointer construct cleanly and report the expected statuses. Null with zero capacity still works. Null with nonzero capacity still asserts (death test).Svc_FileUplink_ut_exe: 1-byte, 2-byte descriptor-only, and 3-byte truncated-body packets each return the buffer and emit exactly one warning event.Svc_Ccsds_CfdpManager_ut_exe: 2-byte descriptor-only packet returns the buffer with no events. 3-byte control reaches the engine and reports a header deserialization failure.All three suites pass (68, 15 and 195 tests). With the source changes reverted, the new 2-byte tests in both components abort at the assertion, confirming they exercise the reported path.
🤖 Generated with Claude Code