Test for issue https://sourceware.org/PR35092
fixed with the previous gnulib commit ????????

* tests/paste/multi-byte.sh: Add a test case.
* NEWS: Merge the paste info to the nufmt the bug fix entry.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-6NCJ14Q1.
---
 NEWS                      |  8 ++++----
 tests/paste/multi-byte.sh | 16 ++++++++++++++++
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index b11786299..e919948e5 100644
--- a/NEWS
+++ b/NEWS
@@ -257,10 +257,10 @@ GNU coreutils NEWS                                    -*- 
outline -*-
   silently converted to 99000 rather than being diagnosed as invalid.
   [bug introduced in coreutils-9.9]
 
-  'numfmt -d' and 'numfmt -s' no longer has buffer overflows, when a
-  multi-byte delimiter matches fewer bytes than specified.  This was seen on
-  systems with invalid encoding configurations.  E.g. glibc with CP1255.
-  [bug introduced in coreutils-9.9]
+  'numfmt -d', 'numfmt -s' and 'paste -d' no longer have buffer overflows, 
where
+  a decoded multi-byte character can exceed the locale's max character length.
+  GLIBC has such an invalid behavior with CP1255, CP1258, and TSCII encodings.
+  [bug introduced in numfmt in coreutils-9.9 and paste in coreutils-9.10]
 
   'od' now exits gracefully when offsets overflow integer limits.
   [This bug was present in "the beginning".]
diff --git a/tests/paste/multi-byte.sh b/tests/paste/multi-byte.sh
index 54c51b9dd..5d7ed5ff7 100755
--- a/tests/paste/multi-byte.sh
+++ b/tests/paste/multi-byte.sh
@@ -106,4 +106,20 @@ if test "$(locale charmap 2>/dev/null | sed 's/gb/GB/')" = 
GB18030; then
   compare exp out || fail=1
 fi
 
+# In CP1255, glibc can decode two bytes as one character with MB_CUR_MAX=1.
+# Ensure glibc with or without the bug is handled appropriately
+# The GLIBC issue is https://sourceware.org/PR35092
+export LC_ALL= LC_CTYPE=yi_US LC_MESSAGES=C
+if test "$(locale charmap 2>/dev/null)" = CP1255; then
+
+  delims=$(env printf '\351\304')
+  paste -s -d "$delims" f3 > out || fail=1
+  if test "$(locale ctype-mb-cur-max 2>/dev/null)" = 1; then
+    env printf '1\3512\3043\n' > exp || framework_failure_
+  else
+    env printf '1\351\3042\351\3043\n' > exp || framework_failure_
+  fi
+  compare exp out || fail=1
+fi
+
 Exit $fail
-- 
2.56.0


Reply via email to