fix(cli): guard min-time overflow + normalize 0 exec-timeout to null + stale comment (#54 review)

This commit is contained in:
Joseph Doherty
2026-06-19 03:24:11 -04:00
parent 597d664a53
commit e3b83f8561
4 changed files with 41 additions and 4 deletions
@@ -395,6 +395,14 @@ public static class TemplateCommands
return false;
}
// Guard against overflow: reject if amount * factorMs would exceed TimeSpan.MaxValue (in ms).
// The divide is safe because factorMs is always >= 1.
if (amount > TimeSpan.MaxValue.TotalMilliseconds / factorMs)
{
error = $"Invalid --min-time-between-runs '{value}': value is too large.";
return false;
}
// 0 (with or without a unit) → unset, mirroring DurationInput.Compose's non-positive handling.
duration = amount == 0 ? null : TimeSpan.FromMilliseconds(amount * factorMs);
return true;