PyTorch torch.nn.utils.rnn.pad_packed_sequence memory corruption
PyTorch version 2.6.0 contains a segmentation fault vulnerability in functions that process packed RNN sequences when given empty tensor inputs, assigned CVE-2025-2998. The vulnerability results from missing error checking for empty data cases rather than graceful error handling.
What happened
A segmentation fault vulnerability was discovered in PyTorch version 2.6.0 affecting the torch.nn.utils.rnn.pad_packed_sequence and torch.nn.utils.rnn.unpack_sequence functions when processing empty tensor inputs.
The functions cause a hard crash when provided with empty data tensors and empty batch sizes, as demonstrated by test cases that trigger the fault with minimal code.
Reported impact
The vulnerability is assigned CVE-2025-2998 for pad_packed_sequence and CVE-2025-2999 for unpack_sequence, with Snyk reporting it as a high severity issue with a score of 8.2.
Index analysis
The issue was identified as a problem manifesting as a hard crash rather than a RuntimeError, attributed to incorrect error checking for empty tensor cases.
Classification
Sources and evidence
This record was researched and written by the Index, based on the following original reporting.