fix(cli): guard min-time overflow + normalize 0 exec-timeout to null + stale comment (#54 review)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user