You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unbounded memory allocation in header parsing #572
The helper Header::read and its buffered/async variants (fn read, fn read_async, fn read_buffered, and fn read_async_buffered) call the nom parser in a loop. When the parser returns Incomplete(Needed::Size(n)), the code blindly executes data.resize(m + n, 0) and then read_exact the additional bytes. Because n is attacker-influenced and no upper bound is enforced, a hostile file can force arbitrarily large allocations, leading to memory-exhaustion denial of service.
Recommendation:
Abort header parsing when the accumulated buffer exceeds 64 KiB (the limit used by the reference Go implementation) or a tighter value mandated by project policy. Propagate a DecryptError::InvalidHeaderSize to callers.
Activity