Security context

What an agent needs to avoid regressing past fixes and find the next vuln in this repo.

huggingface/safetensors
main @ 6eb4dc9
3
Fixes
0
CVEs
HIGH
Peak severity
100.0%
Coverage
Highlights
Integer Overflow: 3 prior fixes. Scrutinize any change in this area.
bindings/python/src/lib.rs: most-fixed (2 issues). Treat as high-risk during review.
2 high-severity fixes in this history; regressions here are high-impact.
Recurring patterns

The bug types that recur here, drawn from past fixes, not open vulnerabilities.

Integer Overflow: Calculating the total element count of a tensor via product multiplication of its dimensions can overflow, leading to an incorrect buffer size calculation and subsequent out-of-bounds memory access. Developers must use checked arithmetic when computing tensor metadata sizes.
Integer Overflow: On platforms like Windows where long types differ in size, passing large 64-bit offsets to Python FFI boundary functions like PySlice::new can cause severe truncation or integer overflow. Alternative safe FFI APIs must be used to enforce architecture-independent boundaries.
Integer Overflow: Parsing F4 tensors with extremely large last dimensions can cause integer overflow when calculating shape offsets. Safeguards using checked multiplication must be implemented at the parser level to prevent memory corruption.