Skip to content

fix(q): harden codec and connection handling - #15

Merged
protocolstardust merged 1 commit into
RayforceDB:masterfrom
belowzeroff:fix/q-codec-transport-safety
Oct 12, 2026
Merged

protocolstardust merged 1 commit into
RayforceDB:masterfrom
belowzeroff:fix/q-codec-transport-safety

Conversation

@belowzeroff

Copy link
Copy Markdown
Contributor

Summary

  • Reject unsupported nested values before serialization, check encoded sizes, and bound recursive decoding depth.
  • Preserve keyed-table dictionaries when encoding and decoding, and validate Q handles before closing or narrowing them to socket descriptors.
  • Keep poll writes bounded, queue server responses through writable events, return a complete response before processing a following FIN, and shut down blocking streams after transport or framing failures.
  • Close Q listeners when their poll is destroyed and add regression coverage for the reported failures.

User-facing behavior

Malformed or excessively nested Q messages now return an error instead of corrupting memory or exhausting the process stack. Poll-attached sends honor the configured timeout, slow readers no longer block the shared event loop, and timed-out blocking connections cannot deliver a stale response to the next request. Keyed tables retain their Q dictionary wire type, and closing an invalid or oversized handle cannot close an unrelated descriptor.

Tests

  • Full test/run.sh integration suite, including real-q interoperability and poll push tests.
  • Full integration suite built with AddressSanitizer and UndefinedBehaviorSanitizer (ASAN_OPTIONS=detect_leaks=0).

@protocolstardust
protocolstardust merged commit c7d98f3 into RayforceDB:master Oct 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants