TorchScript Size/Stride Metadata OOB Read
Defensive validation / triage only.
This PoC shows that a crafted TorchScript artifact can widen a tensor's
logical shape through serialized _rebuild_tensor_v2 metadata while keeping
the backing storage at one float. The loader accepts the artifact, and normal
inference then reads a second logical element outside the serialized storage
extent.
Files:
model/clean.pt: clean controlmodel/evil_size2.pt: crafted artifact with widened logical tensor viewmodel/build-meta.json: hashes and generation metadatareproduce/replay_jit_size_stride_oob.py: replay script for clean vs crafted load/inference
Quick repro:
python reproduce/replay_jit_size_stride_oob.py \
--clean model/clean.pt \
--crafted model/evil_size2.pt