Skip to content

Potential Unsound Issue when dealing with ZST #1

@CXWorks

Description

@CXWorks

Describe the bug
Hi, thanks for your time. Our static analyzer finds the PageVec doesn't check for ZST as element.

To Reproduce
Please run folloiwng poc:

use memory_pages::PagedVec;

#[derive(Debug)]
struct A;
fn main() {
    let mut vec = PagedVec::<A>::new(0);
    vec.reserve(1000);
    println!("{:?}", vec.len());
}

Expected behavior
Program executed and exit with 0.

For crashes
Failed to check for ZST, leading to divides by 0 error

OS version
N/A

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions