Validate malformed input packets before decoding - #2024
Conversation
71b6634 to
11dd00f
Compare
|
Testing update for this PR: I re-tested the covered cases against both current master and this feature branch. For the baseline check, I applied only the test/CMake changes to
Then I ran the same tests on this PR branch. Results:
So the automated regressions covered by this PR are verified: the tests fail or crash on master with only the tests applied, and pass on the PR branch. The remaining Enttec DMX USB Pro malformed-input path is still not covered by an automated test in this verification pass. |
Origin: reported in PR mcallegari#1955. The regression test creates a fixture on universe 1, then calls `setfixture` with a runtime universe list that only contains universe 0. Before this fix, `handleSetFixture()` indexed `universes[1]` and could read past the list. Reject the command before requesting a fader when the fixture universe is not present in the runtime universe list. This keeps malformed or inconsistent projects from crashing script playback. Added a regression test in `script_test` for a fixture whose universe is missing from the runtime universe list. Signed-off-by: Christoph Müllner <christophm30@gmail.com>
Origin: reported in PR mcallegari#1955. The regression test covers protocol inputs rather than GUI steps: a 186-byte ArtPollReply, a short ArtDMX packet, an ArtDMX packet whose length field exceeds the datagram, and a TOD packet with `uidCount` 1 but no UID bytes. These inputs previously reached fixed-offset reads or accepted an incomplete UID list. Validate the minimum ArtPollReply size, the ArtDMX fixed header and advertised payload length, and the TOD UID list length before decoding. Extended `artnet_test` to cover short ArtPollReply, short ArtDMX, truncated ArtDMX payload, and truncated TOD UID list packets. Signed-off-by: Christoph Müllner <christophm30@gmail.com>
Origin: reported in PR mcallegari#1955. The regression test covers protocol inputs rather than GUI steps: a 125-byte packet missing the DMX start code, a zero property value count, and a packet whose count exceeds the remaining datagram. Before this fix, `checkPacket()` accepted the missing-start-code packet and `fillDMXdata()` could read byte 125 or underflow `length - 1`. Require the start-code byte before accepting an E1.31 DMX packet, then reject zero, oversized, or truncated property value counts before copying DMX slots. Added `e131packetizer_test` to cover a missing start code, zero property value count, truncated payload, and a valid packet. Signed-off-by: Christoph Müllner <christophm30@gmail.com>
Origin: reported in PR mcallegari#1955. The regression test covers protocol inputs rather than GUI steps: an OSC message whose type-tag list has no NUL terminator, a message whose string argument is missing its NUL terminator, and a bundle with a valid first message followed by a trailing 3-byte message-size field. Before this fix, parseMessage() could scan past the message buffer or accept a truncated argument, and the bundle parser could read bufPos + 3 past the packet. Stop type-tag and string-argument scanning at the buffer end. Reject fixed-size arguments whose bytes are not fully present, and require four bytes before reading each bundled message size. Added oscpacketizer_test to cover unterminated type tags, truncated string arguments, short bundle size fields, and a valid bundled message. Signed-off-by: Christoph Müllner <christophm30@gmail.com>
Origin: derived while validating PR mcallegari#1955. The regression test uses protocol inputs in artnet_test: a one-byte RDM start-code packet, a 22-byte fixed header, a packet whose PDL claims 21 bytes without carrying that payload, and a DEVICE_INFO response whose valid checksum covers a too-short PID payload. Before this fix, parsePacket() could read the sub-start code, fixed response fields, or PID-specific payload beyond the reply buffer or beyond the declared PDL. Validate the fixed response header before decoding fields, then require PDL bytes plus the checksum before entering PID-specific parsing. Reject PID payloads that are too short for fixed-field decoders, and decode the 19-byte DEVICE_INFO sensor-count field at its protocol offset. Extended artnet_test to cover short RDM headers, truncated PDL payloads, too-short PID payloads, and valid RDM packets. Signed-off-by: Christoph Müllner <christophm30@gmail.com>
11dd00f to
f123d95
Compare
|
I removed the Enttec DMX USB Pro input-path change from this PR. That path needs validation with compatible hardware, which I do not have, so it should not be part of this PR. The remaining changes are limited to parser/script paths covered by automated regression tests. With this, I believe that this PR becomes a set of non-controversial fixes with tested fixes. I also rebased the branch onto current |
Description
Summary of Changes:
This PR fixes malformed-input reliability issues found while reviewing
stale PR #1955 and adjacent parser code.
The affected parsers now reject short or inconsistent input before
reading fixed fields or payload bytes. Well-formed input is handled as
before.
Commit Guide
script_testfor a fixture whose universe is absent from the runtime universe list.artnet_testwith short ArtPollReply, ArtDMX and ArtTOD packets.e131packetizer_testcoverage for missing start code, zero count, truncated payload and a valid packet.oscpacketizer_testcoverage for unterminated type tags, truncated string arguments, short bundle size fields and a valid bundle.artnet_testwith short RDM headers, oversized or truncated PDL values, too-short PID payloads, and valid ACK responses.Testing
Automated Coverage:
The parser paths with in-tree harnesses are covered by:
script_testartnet_teste131packetizer_testoscpacketizer_testResult:
The added and extended tests pass locally.
Manual Testing Gaps
The Enttec DMX USB Pro input-path change is not covered by an
automated regression test because the current tree does not provide a
device-level test harness for that plugin.
A reviewer with compatible hardware can help confirm there is no
behavioral regression by connecting the device, enabling the DMX USB
plugin, and verifying that normal DMX input and MIDI input still work.
Additional Notes
The fixes are split into one commit per issue so individual parser
changes remain easy to review and bisect.
Each commit body contains the full rationale and reproduction details.
Checklist
{on a new line for functions and class definitions.