Reject exactly negative transcript timestamps

This commit is contained in:
2026-11-26 01:27:39 +00:00
parent 4026e26e76
commit 08a9bea23b
4 changed files with 48 additions and 7 deletions

View File

@@ -183,13 +183,13 @@ func validTimestamp(value fmt.Stringer, label string) (*big.Rat, error) {
if math.IsInf(parsed, 0) || math.IsNaN(parsed) {
return nil, inputErrorf("%s must be finite", label)
}
if parsed < 0 {
return nil, inputErrorf("%s must not be negative", label)
}
rat, ok := new(big.Rat).SetString(raw)
if !ok {
return nil, inputErrorf("%s must be a valid number", label)
}
if rat.Sign() < 0 {
return nil, inputErrorf("%s must not be negative", label)
}
return rat, nil
}