Commit 11dd00f
committed
DMX USB: validate Enttec input payload offsets
Origin: derived while validating PR #1955. The payload-length guard
was found while reviewing the same Enttec input parsing path.
Feed the Enttec DMX USB Pro input path a receive-DMX packet with a
payload length of 0 or 1, or a MIDI input packet ending with an
incomplete command. The DMX branch read the status and start-code bytes
without proving they existed, and the MIDI branch read data bytes at
i + 1 and i + 2 for a truncated final command.
The DMX branch also derived its slot-data slice from packet.size().
That is equivalent for well-formed packets, but using the validated
payload offset makes the relationship to the decoded header explicit and
keeps the malformed-payload checks localized.
Reject malformed DMX payloads before decoding fixed fields, copy DMX
data from the validated payload offset, and ignore a trailing incomplete
MIDI command.
No automated regression test exists for this device input path.
Signed-off-by: Christoph Müllner <christophm30@gmail.com>1 parent 0d4a246 commit 11dd00f
1 file changed
Lines changed: 50 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
529 | 536 | | |
530 | 537 | | |
531 | 538 | | |
| |||
544 | 551 | | |
545 | 552 | | |
546 | 553 | | |
547 | | - | |
| 554 | + | |
548 | 555 | | |
549 | 556 | | |
550 | 557 | | |
| |||
990 | 997 | | |
991 | 998 | | |
992 | 999 | | |
993 | | - | |
| 1000 | + | |
| 1001 | + | |
994 | 1002 | | |
995 | 1003 | | |
996 | 1004 | | |
997 | 1005 | | |
998 | 1006 | | |
999 | | - | |
1000 | | - | |
1001 | | - | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
1002 | 1045 | | |
1003 | 1046 | | |
1004 | 1047 | | |
| |||
1009 | 1052 | | |
1010 | 1053 | | |
1011 | 1054 | | |
1012 | | - | |
| 1055 | + | |
1013 | 1056 | | |
1014 | 1057 | | |
1015 | 1058 | | |
1016 | | - | |
| 1059 | + | |
1017 | 1060 | | |
1018 | 1061 | | |
1019 | 1062 | | |
| |||
0 commit comments