hyperium / http

Rust HTTP types
Apache License 2.0
1.12k stars 283 forks source link

Arithmetic overflow found on `to_raw_capacity()` #626

Closed HeeillWang closed 8 months ago

HeeillWang commented 9 months ago

I executed fuzz testing on http-0.2.9, and found some arithmetic overflow.

#[inline]
fn to_raw_capacity(n: usize) -> usize {
    n + n / 3   // overflow!
}

reproduce with :

HeaderMap::<u32>::with_capacity(17798225791641714878);  // put some big number here