189bb31737
#1 [HIGH, was a real DoS]: readNetstringStream read the length token via bufio.ReadString(':'), which buffers the whole pre-':' run UNBOUNDED — the 1<<24 cap only bounded the body, applied AFTER the token was parsed. A protocol-confined caller sending an endless digit run with no ':' drove sicd to ~1 GB RSS (measured by @reviewer). Now the token is read byte-by-byte with an 8-digit hard cap (a valid <=1<<24 length is 8 digits), so it rejects after <=9 bytes regardless of input size — memory is bounded by construction, before the value is trusted. #2 [MED]: nothing bounded the NUMBER of netstrings per frame (2M tiny ones ~140 MB before exec). runV1 now caps element count (4096) and total argv bytes (1<<20). #3 [MED, documented]: an empty netstring 0:, is always the terminator, so a legit empty "" argument collides with it (silent argv truncation + stdin bleed). Inherent to the v1 wire, not introduced here — noted in a comment; a fix would need a wire change. Regression tests: overlong length token (100k digits) -> exit 1; 9-digit length -> exit 1; frame over the element cap -> exit 1. go test ./... ok, go vet clean. Found by @reviewer's probe (reproduced 1 GB RSS), not a re-read — exactly why the outside look isn't skippable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>