Repository navigation
Safely parse unaligned ancillary messages - #9640
Conversation
Assisted-by: OpenAI Codex:model version not exposed
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 35 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Merging this PR will not alter performance
Comparing Footnotes
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Parse ancillary-message bytes without assuming the public input slice is aligned for
cmsghdr. Read complete headers with unaligned loads and validate data-prefix, declared-length, available-byte and next-offset bounds before slicing or advancing. A truncated final payload is returned only up to the bytes available; malformed short headers terminate parsing rather than underflowing.Preserve the relevant platform-specific next-header rules, including Solaris/illumos rounding, Linux musl/ohos and emscripten strict end boundaries, and Hurd's next-message fit check. For an unaligned slice, offsets are interpreted relative to the beginning of the supplied bytes. Traversal continues to use the existing i32-sized
checked_cmsg_spacebound.This does not change the generic ancillary packer, whose alignment and ownership require separate work, and does not claim complete Python recvmsg diagnostics or arbitrary-platform runtime parity. #9638 separately addresses the AF_ALG send helper.
Validation
libc0.2.189 platform CMSG layouts and boundary rules, unaligned accesses, checked arithmetic, lifetimes, malformed inputs and test safety.CMSG_NXTHDRmacro. These validate byte-buffer invariants, not Python API behavior.rustfmt,git diff --check, and normal repository hooks passed. Source merge-tree with Safeguard AF_ALG control and send buffers #9638 was clean.