* NEWS: Mention the bug fix.
* src/unexpand.c (unexpand): Check if the column is greater or equal to
the next_tab_column.
* tests/unexpand/mb.sh: Add a test case.
https://github.com/coreutils/coreutils/pull/285
Copyright-paperwork-exempt: Yes
'tee' no longer treats short writes as errors.
[bug introduced in coreutils-9.11]
- 'unexpand -t' no longer overflows a heap buffer, for tab values > SIZE_MAX/16.
+ 'unexpand -t' no longer overflows a heap buffer, for tab values > SIZE_MAX/16,
+ or with multi-byte blank characters longer than the tab value.
[bug introduced in coreutils-9.11]
'uniq -w' no longer overruns the read buffer in multibyte locales.
{
column += c32width (g.ch);
- if (! (prev_blank && column == next_tab_column))
+ if (! (prev_blank && column >= next_tab_column))
{
/* It is not yet known whether the pending blanks
will be replaced by tabs. */
test "$ret" = 1 || test "$ret" = 0 || { cat err; fail=1; }
done
+# A blank whose display width exceeds the tab distance must not overrun
+# the pending-blank buffer. With -t1 every column is a tab stop, so a
+# width-2 ideographic space steps over the stop without landing on it;
+# the run of blanks then grew pending_blank without bound.
+ideo_space=$(env printf '\u3000')
+{ yes "$ideo_space" | head -n 40000 | tr -d '\n'; echo; } |
+ unexpand -t1 >out 2>err; ret=$?
+test "$ret" = 0 || { cat err; fail=1; }
+
Exit $fail