Tighten decoding of packages#189
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens incoming PDU decoding and error classification across COMSTACK transports and BER/HTTP completeness detection, with stricter limits on maximum received PDU sizes and clearer protocol-error signaling.
Changes:
- Enforces a 16MB maximum incoming PDU size (TCP/IP, UNIX sockets, and server defaults) and treats malformed PDUs as protocol errors.
- Updates HTTP/BER “complete PDU” detection to return
-1on protocol errors, and plumbs a newCSPROTERRerror code through the stack. - Improves ODR constructed-type stack depth tracking to avoid re-walking the stack for depth checks.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/zoom-c.c | Adjusts cs_get error handling/logging during ZOOM read processing. |
| src/yaz/comstack.h | Documents cs_complete_auto* return semantics and adds CSPROTERR. |
| src/unix.c | Adds max receive cap and propagates protocol-error detection from complete(); updates cs_more semantics. |
| src/tcpip.c | Reduces default max_recv_bytes, tightens buffer growth, and maps complete()<0 to protocol error. |
| src/statserv.c | Lowers default maximum allowed PDU size to 16MB. |
| src/seshigh.c | Uses protocol error reasons for Close PDUs and updates error-path message ownership semantics. |
| src/odr.c | Resets new stack_depth field on odr_reset. |
| src/odr-priv.h | Introduces stack_depth and updates ODR_STACK_POP to maintain it. |
| src/odr_cons.c | Replaces stack-depth counting loop with stack_depth tracking. |
| src/comstack.c | Adds new protocol error message and hardens HTTP parsing/completeness logic. |
| src/ber_tag.c | Updates ber_dectag return-value documentation. |
| src/ber_len.c | Tightens BER length decoding to reject lengths too large for int. |
| src/ber_any.c | Treats malformed BER as protocol error (-1) rather than “complete”. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
…to cs-complete-may-return-error
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.
No description provided.