On 18/11/2026 15:30, Martin Mirchev wrote:
Hi,

Source: coreutils master 75e1b68 (2026-11-18); isuz85() is unchanged since
at least 35492ca.

With --ignore-garbage, basenc --z85 should discard bytes outside the Z85
alphabet, and it does for most of them, but not for NUL. isuz85() in
src/basenc.c checks the punctuation with strchr(), which also matches the
terminating NUL of its string argument, so a NUL byte is treated as a Z85
character and the input then fails to decode:

$ printf 'he|l1o' | basenc --z85 -d -i | od -An -tx1 # 35 6a 51 d1, exit 0
$ printf 'he\0l1o' | basenc --z85 -d -i # basenc: invalid input, exit 1

base64, base32 and the other encodings ignore a NUL byte under -i as
expected.

The attached patch excludes NUL in isuz85() and adds a case to the basenc
test script, which fails before the change and passes after it.

Found by an LLM-assisted tool, verified manually.
I'll apply that with a NEWS entry.

Marking this as done.

thanks!
Padraig



Reply via email to