summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--src/pr.c2
-rwxr-xr-xtests/pr/pr-tests.pl7
3 files changed, 12 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index edfbdfa1d..ba7679ffd 100644
--- a/NEWS
+++ b/NEWS
@@ -35,6 +35,10 @@ GNU coreutils NEWS -*- outline -*-
nl now resets numbering for each page section rather than just for each page.
[This bug was present in "the beginning".]
+ pr now handles specified separator strings containing tabs correctly.
+ Previously it would have output random data from memory.
+ [This bug was detected with ASAN and present in "the beginning".]
+
sort -h -k now works even in locales that use blank as thousands separator.
stty --help no longer outputs extraneous gettext header lines
diff --git a/src/pr.c b/src/pr.c
index 20e863760..26f221f99 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -1233,7 +1233,7 @@ init_parameters (int number_of_files)
}
/* It's rather pointless to define a TAB separator with column
alignment */
- else if (!join_lines && *col_sep_string == '\t')
+ else if (!join_lines && col_sep_length == 1 && *col_sep_string == '\t')
col_sep_string = column_separator;
truncate_lines = true;
diff --git a/tests/pr/pr-tests.pl b/tests/pr/pr-tests.pl
index 4d85dc989..ec3980af3 100755
--- a/tests/pr/pr-tests.pl
+++ b/tests/pr/pr-tests.pl
@@ -467,6 +467,13 @@ push @Tests,
{IN=>{3=>"x\ty\tz\n"}},
{OUT=>join("\t", qw(a b c m n o x y z)) . "\n"} ];
+# This resulted in reading invalid memory before coreutils-8.26
+push @Tests,
+ ['asan1', "-m -S'\t\t\t' -t",
+ {IN=>{1=>"a\n"}},
+ {IN=>{2=>"a\n"}},
+ {OUT=>"a\t\t\t\t \t\t\ta\n"} ];
+
@Tests = triple_test \@Tests;
my $save_temps = $ENV{DEBUG};