aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2024-01-18 00:05:18 +0000
committerPádraig Brady <P@draigBrady.com>2024-01-18 16:52:36 +0000
commitc01ee1893448bdf1bbd81fa15a35472d07a356b8 (patch)
treeb14cfa35a06345ae1a8f617a8c84ff221d64f629 /tests
parenttests: make ulimit -v interact better with ASAN (diff)
downloadcoreutils-c01ee1893448bdf1bbd81fa15a35472d07a356b8.tar.gz
coreutils-c01ee1893448bdf1bbd81fa15a35472d07a356b8.zip
doc: split -C: test and document a heap overflow
This was introduced in coreutils 9.2 through commit v9.1-184-g40bf1591b, and was fixed in coreutils 9.5 through commit v9.4-111-gc4c5ed8f4. This issue has been assigned CVE-2024-0684. * NEWS: Mention the bug fix. * tests/split/line-bytes.sh: Add a test case. Reported by Valentin Metz.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/split/line-bytes.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/split/line-bytes.sh b/tests/split/line-bytes.sh
index 6c57ad1a1..a396cd797 100755
--- a/tests/split/line-bytes.sh
+++ b/tests/split/line-bytes.sh
@@ -84,4 +84,16 @@ for b in $(seq 10); do
compare no_eol_splits_exp no_eol_splits || fail=1
done
+# Test hold buffer management with --lines-bytes.
+# The following triggers (with ASAN) a heap overflow issue
+# between coreutils 9.2 and 9.4 inclusive.
+printf '%131070s\n' '' >expaa || framework_failure_
+printf 'x\n' >expab || framework_failure_
+printf '%131071s\n' '' >expac || framework_failure_
+cat expaa expab expac >bigin || framework_failure_
+split -C 131072 ---io=131072 bigin || fail=1
+compare expaa xaa || fail=1
+compare expab xab || fail=1
+compare expac xac || fail=1
+
Exit $fail