Commit 46600c3
committed
fix(netwatch): guard divide-by-zero in poll_recv_noq trace
`UdpSocket::poll_recv_noq` evaluated `meta.len / meta.stride` directly
inside `trace!()` macro arguments. `noq_udp::RecvMeta.stride` is allowed
to be `0` in practice on the GRO path (empty datagrams, kernel falling
back to a non-segmented receive), which crashes the host process with
`attempt to divide by zero` — observed on Windows 11 24H2 and macOS
15.4/26.x against netwatch 0.16.0/0.17.0.
Replace the bare division with `checked_div(...).unwrap_or(0)` so the
trace field reports `0` when `stride == 0` and stays identical
otherwise.
Closes #148.1 parent 7c952d5 commit 46600c3
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
436 | | - | |
| 436 | + | |
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
| |||
0 commit comments