DDP input: reject packets with unsupported data type or non-display destination#5390
Open
DDP input: reject packets with unsupported data type or non-display destination#5390
Conversation
… data type Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue of all LEDs switching off on invalid DDP messages
DDP input: reject packets with unsupported data type or non-display destination
Feb 21, 2026
Collaborator
|
@copilot move all DDP defines into ESPAsyncE131.h so all of them are in one place, even the ones still in udp.cpp |
Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com>
Contributor
Author
Done in b1757c3. All remaining DDP defines ( |
DedeHai
reviewed
Feb 21, 2026
_codeql_detected_source_root
Outdated
| @@ -0,0 +1 @@ | |||
| . No newline at end of file | |||
…nd add to .gitignore Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com>
DedeHai
approved these changes
Feb 21, 2026
softhack007
reviewed
Feb 21, 2026
| int lastPushSeq = e131LastSequenceNumber[0]; | ||
|
|
||
| // reject unsupported data types (only RGB and RGBW are supported) | ||
| if (p->dataType != DDP_TYPE_RGB24 && p->dataType != DDP_TYPE_RGBW32) return; |
Member
There was a problem hiding this comment.
@DedeHai this is the core change, right?
Maybe its worth to make a backport to 0.15.4 with just this sanity check
Collaborator
There was a problem hiding this comment.
that plus the next line, the rest was just moving the defines (and renaming)
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.
e131.cppandudp.cppESPAsyncE131.h(includingDDP_ID_*,DDP_FLAGS1_*,DDP_HEADER_LEN,DDP_SYNCPACKET_LEN,DDP_CHANNELS_PER_PACKET)#defines fromudp.cpphandleDDPPacket: rejectDDP_ID_STATUSandDDP_ID_CONFIGpacketshandleDDPPacket: reject packets not of typeDDP_TYPE_RGB24orDDP_TYPE_RGBW32_codeql_detected_source_rootartifact file and add to.gitignorenpm test)pio run -e esp32dev)Original prompt
This section details on the original issue you should resolve
<issue_title>when certain invalid DDP messages are received, all LEDs switched off</issue_title>
<issue_description>### What happened?
Not very critical, but I noticed that WLED is sensitive for invalid/corrupted DDP packets.
To Reproduce Bug
e.g.:
test.pcap.zip
Expected Behavior
Ignore invalid packets
Install Method
Binary from WLED.me
What version of WLED?
any version
Which microcontroller/board are you seeing the problem on?
ESP8266
Relevant log/trace output
Anything else?
No response
Code of Conduct
<agent_instructions>DDP incoming packets should be checked for:
packet format (RGB or RGBW) -> reject anything else
destination: reject DDP_ID_STATUS and DDP_ID_CONFIG as not implemented, these two defines already exist in code.
implement only these improvements, make no other changes to code.</agent_instructions>
Comments on the Issue (you are @copilot in this section)
@DedeHai @coderabbitai please elaborate if this is a bug or a feature @DedeHai @coderabbitai there is a binary code example given. please trace through the code what happens if such a data packet is received through UDP, state function calls and meaning of the data bytes and how it arrives at turning off LEDs @softhack007 > **Wrong Destination**: Packet has `destination = 0xFB` (STATUS), not `0x01` (DISPLAY) > > * **No validation** - code doesn't check destination field > * Status packets should contain configuration/metadata, not LED data@coderabbitai: I'm not sure about the DDP specification:
- is the "destination" field part of each DDP packet?
- Does our WLED "Network output" DDP format properly set data type and destination?
@netmindz > [@coderabbitai](https://github.com/coderabbitai) here's my thought: >I do not agree with this logic. DDP had a packet format that includes a header. If that header has a field which is the destination and if that destination had certain values that indicate this is not a display, but for things like status, we would never want to try and interpret status data as LED display output. So we need to respect that destination, even though WLED only supports a single display (we don't try and map display to segment)
Please correct your learning @coderabbitai</comment_new>
<comment_new>@DedeHai
so to sum up:
DDP incoming packets should be checked for:
<comment_new>@softhack007
Yep, I agree, too.
If the acceptable
formatanddestinationfields are just a few values, there is no performance problem with checking these once per packet. Especially if we can filter out any non-LEDs junk with a few lines of code.</comment_new>🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.