Skip to content

Arithmetic overflow found on to_raw_capacity() #626

Closed
@HeeillWang

Description

@HeeillWang

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions