Record the repeat cap's reach, 64-bit only, the constant-divisor rule and the rejected default spellings; correct the repeat cap comment
Tests / vet + fmt + tests (pull_request) Successful in 58s

This commit is contained in:
2026-09-02 19:09:50 +02:00
parent 08c7ef9b7f
commit c5304bb6e7
2 changed files with 17 additions and 1 deletions
+1 -1
View File
@@ -288,7 +288,7 @@ func repeatOf(m map[string]any) (int, error) {
if r == 1 {
return 0, fmt.Errorf("repeat 1 is the default, so it has no effect; drop it")
}
if r > maxLen { // cap so a fat-fingered repeat can't build a multi-GB string
if r > maxLen { // caps the renders one repeat asks for; checkRepeatReach bounds what nested ones multiply to
return 0, fmt.Errorf("repeat %v exceeds the maximum %d", rv, maxLen)
}
return int(r), nil