Harden receiver cancellation, deadlines, and manifest validation #202
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity
High
Description
Several malformed-input paths can exhaust or wedge a receiver: accepted sockets lack receive/send timeouts, protocol deadlines are checked only before blocking reads, manifest counts are unbounded and decode failures are ignored, and multithreaded receiver errors can leave writer/join state blocked.
Location
Validation
Connect and send only part of a length field while keeping the socket open; send an oversized/truncated manifest; disconnect during a multithreaded chunk transfer. Confirm the worker remains occupied or the handler fails to return.
Suggested implementation
Apply deadlines to accepted sockets and TLS handshakes (poll/nonblocking where needed), bound manifest counts and reject every decode/allocation failure, and use one cancellation cleanup path that marks completion and broadcasts all queue conditions before joining threads. Add malformed-protocol and disconnect tests.