CVE-2026-4538: Pytorch Unsafe Torch Load Fallback

A try/except block blindly falls back to `torch.load(..., weights_only=False)` after failing to load with `weights_only=True`. This completely bypasses the security benefits of `weights_only=True`, exposing the application to unsafe deserialization (CWE-502) which can lead to arbitrary code execution if loading untrusted checkpoints. Ensure such fallback is

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0Python
greprules fetch cve-2026-4538-pytorch-unsafe-torch-load-fallback --engine opengrep

Description

A try/except block blindly falls back to `torch.load(..., weights_only=False)` after failing to load with `weights_only=True`. This completely bypasses the security benefits of `weights_only=True`, exposing the application to unsafe deserialization (CWE-502) which can lead to arbitrary code execution if loading untrusted checkpoints. Ensure such fallback is