PyTorch ctc_loss floating point exception on CUDA with empty tensors
PyTorch's ctc_loss function caused a floating point exception and core dump when called with empty tensors on CUDA devices, whereas the same call on CPU raised a proper error. A fix was applied to add input validation.
What happened
Calling torch.nn.functional.ctc_loss with empty tensors on CUDA devices caused a floating point exception that crashed the program, while the CPU implementation properly raised a RuntimeError instead.
Reported impact
The unhandled exception resulted in a core dump, causing denial of service when the function was invoked with adversarial empty tensor inputs on CUDA.
Index analysis
A pull request added validation to check that the log_probs tensor is not empty before processing, applying consistent error handling between CPU and CUDA implementations.
Classification
Sources and evidence
This record was researched and written by the Index, based on the following original reporting.