Fix #9899 integer overflow in string repeat

We could end up overflowing if we print out something that's a multiple of the
chunk size, which would then finish printing in the chunk-printing, but not
break out early.
This commit is contained in:
Henrik Hørlück Berg
2023-07-17 14:53:03 +02:00
committed by Fabian Boehm
parent 2a13a30807
commit 6325b3662d
3 changed files with 9 additions and 1 deletions

View File

@@ -530,6 +530,10 @@ string repeat -n 17 a | string length
string repeat -m 5 (string repeat -n 500000 aaaaaaaaaaaaaaaaaa) | string length
# CHECK: 5
# might cause integer overflow
string repeat -n 2999 \n | count
# CHECK: 3000
# Test equivalent matches with/without the --entire, --regex, and --invert flags.
string match -e x abc dxf xyz jkx x z
or echo exit 1