Commit 57741b4
fix(bench): validate num_frames > 0 and warmup_frames >= 0
Copilot review on PR #129 caught that the per-frame stats path
unconditionally allocates / sorts / divides by num_frames, which
would OOB-access sorted[num_frames - 1] and divide by zero if a
caller passed 0 or a negative number. Both come from atoi() which
returns 0 on garbage input, so this was reachable.
Validate both at parse time and exit with a clear error before
allocating anything.
Co-Authored-By: Claude Opus 4.7 <[email protected]>1 parent b8cc8b4 commit 57741b4
1 file changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
259 | 270 | | |
260 | 271 | | |
261 | 272 | | |
| |||
0 commit comments