FractalFir / FractalFir/memory_pages
Potential Unsound Issue when dealing with ZST
- Dominant language
- Rust
- Stars
- 32
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
**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:
```rust
use memory_pages::PagedVec;
#[derive(Debug)]
struct A;
fn main() {
let mut vec = PagedVec::::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
Contributor guide
Research direction
Start at the PagedVec::new and reserve entry points used by the reproduction, and inspect how zero-sized element types are handled before page calculations. Run the provided Rust program to reproduce the divide-by-zero failure. Done means the ZST case no longer divides by zero and the program exits successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100