|WARNING| [4/4] app/dumpcap: do not use rte_exit before EAL init

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Tue Nov 17 18:01:24 CET 2026


Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/172993

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-17

**Patch 2/4: app/dumpcap: fix capture duration**

**Warning: unbounded user-supplied duration is converted from double to uint64_t, which is undefined behaviour.**

```
+		stop_tsc = rte_get_tsc_cycles() +
+			(uint64_t)(stop.duration * rte_get_tsc_hz());
```

`stop.duration` comes straight from `strtod()` in `auto_stop()`. It is only checked for `interval <= 0`, so these values are accepted:
- `duration:inf`
- `duration:1e30`
- any value large enough that `duration * tsc_hz` exceeds `UINT64_MAX`

Converting an out-of-range double to `uint64_t` is undefined behaviour in C. Even when the conversion is in range, the addition to `rte_get_tsc_cycles()` can wrap. A wrapped `stop_tsc` that lands in the past ends the capture immediately instead of running effectively forever.

Suggested fix: reject non-finite or excessive durations when parsing, or clamp before the conversion. For example:

```c
double cycles = stop.duration * rte_get_tsc_hz();
uint64_t now = rte_get_tsc_cycles();

if (cycles >= (double)(UINT64_MAX - now))
	stop_tsc = UINT64_MAX;
else
	stop_tsc = now + (uint64_t)cycles;
```

Alternatively, add `!isfinite(interval)` and an upper bound to the check in `auto_stop()`.

Review-Result: WARNING


More information about the test-report mailing list