Downloads · 30 days
0
htdy7703/safetensors-zero-sized-tensor-bomb-poc
safetensors-zero-sized-tensor-bomb-poc is a machine learning model from htdy7703. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This PoC demonstrates a memory-exhaustion denial of service in the Python eager gettensors path by generating a header-only .safetensors file with a very large number of valid zero-sized tensors.
Downloads · 30 days
0
Access
Public
Updated Jul 7, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 38%
From the Hugging Face model README
This PoC demonstrates a memory-exhaustion denial of service in the Python eager get_tensors path by generating a header-only .safetensors file with a very large number of valid zero-sized tensors.
safetensors.numpy.load_file(...) eagerly materializes one array object per zero-sized tensor.safetensors Python wheel 0.8.0.reproduce.py: builds a crafted file and optionally loads it with safetensors.numpy.load_filepython3 -m pip install safetensors numpy
python3 reproduce.py --count 500000 --path zero_500k.safetensors --load
Expected effect:
29 MB500000 empty tensors materialized