decode_chunked

Function decode_chunked 

Source
pub fn decode_chunked(body: &[u8]) -> Result<Vec<u8>, String>
Expand description

Minimal chunked transfer decoding (hex size; optional chunk extensions after ; ignored; final 0-chunk ends the body, trailers after it are accepted and dropped). Public for the integration tests in tests/wasm_plugin_source.rs, which pin the hostile framings (overflow size lines, over-cap sizes, malformed hex, missing CRLFs) as pure functions.

Hostile-input hardening (review finding): every size flows through checked arithmetic. A size line like ffffffffffffffff used to wrap out.len() + size past the cap check (and size + 2 past the truncation guard), reaching &body[..size] as a slice panic that killed startup or unwound the reload watcher. Now the size line must be 1-16 ASCII hex digits, the parsed size is rejected outright above the artifact cap, and both additions are checked.