]> git.ipfire.org Git - thirdparty/coreutils.git/commit
fold: fix handling of invalid multi-byte characters
authorCollin Funk <collin.funk1@gmail.com>
Thu, 28 Aug 2025 01:33:37 +0000 (18:33 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Fri, 29 Aug 2025 01:57:13 +0000 (18:57 -0700)
commit89b9115da67d819e01b4aa541e4672b21e48b250
tree3398a418b7b298bd543b72cdf347c7a0192f9cd7
parent4b35a3b9201742ddff56062a13cf20ce4e9bc9be
fold: fix handling of invalid multi-byte characters

* src/fold.c (fold_file): Continue the loop when we have buffered bytes
but nothing left to read from the file.
(adjust_column): Don't assume that the character is printable.
* tests/fold/fold-characters.sh: Add a new test case.
(bad_unicode): New function.
src/fold.c
tests/fold/fold-characters.sh