]> git.ipfire.org Git - thirdparty/coreutils.git/commit
fold: don't truncate multibyte characters at the end of the buffer
authorCollin Funk <collin.funk1@gmail.com>
Tue, 26 Aug 2025 06:15:21 +0000 (23:15 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Tue, 26 Aug 2025 23:59:32 +0000 (16:59 -0700)
commitae89cd646a7dfd0cf655e8c0d0d56b93288abb71
tree43229cad147335fe1e38709de25a4f61d65bada0
parent01646ccd64dca25af33defca39685026028daecb
fold: don't truncate multibyte characters at the end of the buffer

* src/fold.c (fold_file): Replace invalid characters with the original
byte read. Copy multibyte sequences that may not yet be read to the
start of the buffer before reading more bytes.
* tests/fold/fold-characters.sh: Add a test case.
src/fold.c
tests/fold/fold-characters.sh