Summary
--parameter-scan panics with an integer overflow when the range ends at (or one step below) i32::MAX.
Minimal reproduction
hyperfine --parameter-scan x 2147483646 2147483647 'true'
- Debug/test builds: panics with
attempt to add with overflow.
- Release builds: the addition wraps from
i32::MAX to i32::MIN instead of panicking, so the iterator keeps going and hyperfine tries to generate ~4 billion commands (effectively a hang / OOM).
Cause
--parameter-scan parses min/max as i32 (src/command.rs), and the MAX_PARAMETERS (100,000) cap is only enforced at construction via size_hint. A short range positioned near i32::MAX passes that cap, but the iterator's next() in src/parameter/range_step.rs does an unconditional self.state += self.step. On the final element state == i32::MAX, so state + step overflows — panicking in debug and wrapping in release.
Expected
The scan should yield the in-range values and stop, without overflowing, regardless of where the range sits in the i32 domain.
I have a small fix + regression test ready and will open a PR referencing this issue.
Summary
--parameter-scanpanics with an integer overflow when the range ends at (or one step below)i32::MAX.Minimal reproduction
attempt to add with overflow.i32::MAXtoi32::MINinstead of panicking, so the iterator keeps going and hyperfine tries to generate ~4 billion commands (effectively a hang / OOM).Cause
--parameter-scanparsesmin/maxasi32(src/command.rs), and theMAX_PARAMETERS(100,000) cap is only enforced at construction viasize_hint. A short range positioned neari32::MAXpasses that cap, but the iterator'snext()insrc/parameter/range_step.rsdoes an unconditionalself.state += self.step. On the final elementstate == i32::MAX, sostate + stepoverflows — panicking in debug and wrapping in release.Expected
The scan should yield the in-range values and stop, without overflowing, regardless of where the range sits in the
i32domain.I have a small fix + regression test ready and will open a PR referencing this issue.