PyTorch unpack_sequence segmentation fault with empty tensors
PyTorch's unpack_sequence and pad_packed_sequence functions crash with a segmentation fault when handling empty tensors, due to missing error checking. The vulnerability affects PyTorch 2.6.0 and has been assigned CVE-2025-2999.
What happened
The torch.nn.utils.rnn.unpack_sequence function in PyTorch 2.6.0 causes a segmentation fault when passed a PackedSequence with empty tensors.
The related pad_packed_sequence function exhibits the same crash behavior with empty data and batch sizes.
Reported impact
The segmentation fault causes a hard crash rather than a handled error, preventing graceful failure in applications using these functions with empty sequences.
Index analysis
The vulnerability stems from missing error checking for empty tensor inputs, allowing the functions to attempt operations on uninitialized or invalid memory.
Snyk reported the issue as high severity with a score of 8.2.
Classification
Sources and evidence
This record was researched and written by the Index, based on the following original reporting.