]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: split: reject excessively large suffix lengths
authorSylvestre Ledru <sylvestre@debian.org>
Sun, 7 Jun 2026 09:54:40 +0000 (11:54 +0200)
committerPádraig Brady <P@draigBrady.com>
Tue, 9 Jun 2026 13:22:09 +0000 (14:22 +0100)
* tests/split/suffix-length.sh: Ensure that a pathologically large
-a/--suffix-length value fails gracefully rather than crashing or
hanging.
https://github.com/uutils/coreutils/pull/12609
Closes https://github.com/coreutils/coreutils/pull/282

tests/split/suffix-length.sh

index 84fce04a267b679e9415c0c9d02a6a615f0d3cd3..0b2bf3894a04bbba81341dc968f9e41285ebe767 100755 (executable)
@@ -73,4 +73,13 @@ rm -f x*
 returns_ 1 split -a2 -n1000 < /dev/null || fail=1
 test -f xaa && fail=1
 
+# Ensure that an excessively large suffix length fails gracefully,
+# rather than crashing or hanging.
+rm -f x*
+vm=$(get_min_ulimit_v_ split -a 1 /dev/null)
+if test -n "$vm"; then
+  (ulimit -v $(($vm+6000)) && returns_ 1 split -a 66542562175252 in) || fail=1
+  test -f xaa && fail=1
+fi
+
 Exit $fail