Skip to content

fix: make managed input processing linear - #59

Open
mcollina wants to merge 1 commit into
ShogunPanda:mainfrom
mcollina:security/sec-10-linear-managed-input
Open

mcollina wants to merge 1 commit into
ShogunPanda:mainfrom
mcollina:security/sec-10-linear-managed-input

Conversation

@mcollina

Copy link
Copy Markdown
Contributor

Make automatically managed input linear under byte-fragmented lines.

Retained input now uses an amortized geometrically growing allocation instead of rebuilding the complete prefix on every call. Line scanners preserve their last inspected offset across managed fragments, avoiding repeated rescans of incomplete request/status lines, headers, chunk headers/extensions, and trailers.

The retained allocation remains behind the existing unconsumed pointer/length ABI. Aliased callers may safely pass that retained pointer back to parse() even when growth moves the allocation. Reset, error, and destruction paths release it with its original layout.

Deterministic Rust/WASM instrumentation regressions verify linear aggregate copies and scans across 4,096 single-byte fragments, including CR/LF split resumption. A Rust regression also forces repeated growth while passing the public retained pointer back as input.

Validation: full Rust parser suite and focused rebuilt SIMD/non-SIMD WASM issue suite pass. Independent review found no blockers. The local Binaryen 108 does not support the repository's newer --enable-bulk-memory-opt spelling, so equivalent builds used --enable-bulk-memory.

This fixes SEC-10 from #38.

This branch has not been deployed

No deployments
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.

1 participant