fix: recompute SoE payload pointer in ecx_SoEread - #985
Open
sankalpsthakur wants to merge 1 commit into
Open
sankalpsthakur wants to merge 1 commit into
sankalpsthakur wants to merge 1 commit into
Conversation
ecx_SoEread derived mp from MbxIn while it was still NULL, then memcpy'd from that stale pointer after ecx_mbxreceive updated MbxIn. A slave ReadRes therefore read address 0x0a and crashed the master. Recompute mp from the received mailbox on an accepted SoE ReadRes, and reject a negative framedatasize before memcpy. Fixes OpenEtherCATsociety#981
Eksan0325
reviewed
Sep 8, 2026
Eksan0325
left a comment
Contributor
There was a problem hiding this comment.
SOEM has always been missing servo communication unit tests. have you set up any test conditions for changes in the SoE?
Author
|
At 5487d13, the local mailbox mock passes with Clang, -Wall -Wextra -Werror and AddressSanitizer:
The harness stubs mailbox calls and is not in this PR. Fragmentation, timing, servo and NIC behavior remain untested. Would an in-tree mock be useful, and which runner/location fits the project? |
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.
Fixes #981.
ecx_SoEreadused a NULL-derived payload pointer when reading a valid SoE response. Recomputempfrom the received mailbox before copying the payload.Validation used Clang with AddressSanitizer and a local mailbox mock. A valid one-byte response returned
0x41; a zero-length malformed response reported a packet error and left the destination unchanged. The mock is not included in this PR. The native macOS CMake build was blocked by the missingcmake/Darwin.cmake, so the source check used generated options and Linux OSAL/OSHW headers.Real servo/NIC behavior, fragmentation and mailbox timing remain untested.
AI coding tools assisted with the change and this description.