Pattern: Unsafe use of PyTorch
Issue: -
Using torch.load
with untrusted data can lead to arbitrary code execution, and improper use of torch.save
might expose sensitive data or lead to data corruption.
A safe alternative is to use torch.load
with the safetensors
library from hugingface, which provides a safe deserialization mechanism.