GNU bug report logs - #79184
base32/base64: different behavior of -d with invalid input

Previous Next

Package: coreutils;

Reported by: Daniel Hofstetter <dhofstet <at> gmail.com>

Date: Wed, 6 Aug 2025 16:05:01 UTC

Severity: normal

Tags: notabug

Done: Paul Eggert <eggert <at> cs.ucla.edu>

To reply to this bug, email your comments to 79184 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#79184; Package coreutils. (Wed, 06 Aug 2025 16:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Hofstetter <dhofstet <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 06 Aug 2025 16:05:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Daniel Hofstetter <dhofstet <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: base32/base64: different behavior of -d with invalid input
Date: Wed, 6 Aug 2025 18:04:30 +0200
Hi,

I noticed some inconsistency in how base32 and base64 handle invalid
input when decoding.

base32 simply shows an error on stderr whereas base64 shows an error
on stderr plus some output on stdout.

$ echo 'invalid' | base32 -d 2> /dev/null
$ echo 'invalid' | base32 -d > /dev/null
base32: invalid input
$ echo 'invalid' | base64 -d 2> /dev/null
�{ږ'$
$ echo 'invalid' | base64 -d > /dev/null
base64: invalid input

I'm using coreutils 9.7.

Regards,
Daniel




Information forwarded to bug-coreutils <at> gnu.org:
bug#79184; Package coreutils. (Wed, 06 Aug 2025 17:18:01 GMT) Full text and rfc822 format available.

Message #8 received at 79184 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Daniel Hofstetter <dhofstet <at> gmail.com>
Cc: 79184 <at> debbugs.gnu.org
Subject: Re: bug#79184: base32/base64: different behavior of -d with invalid
 input
Date: Wed, 6 Aug 2025 10:17:32 -0700
On 2025-08-06 09:04, Daniel Hofstetter wrote:
> $ echo 'invalid' | base32 -d 2> /dev/null
> $ echo 'invalid' | base32 -d > /dev/null
> base32: invalid input
> $ echo 'invalid' | base64 -d 2> /dev/null
> �{ږ'$
> $ echo 'invalid' | base64 -d > /dev/null
> base64: invalid input

I don't see a bug here. Both programs convert as much as they can, and 
then stop and diagnose a failure if there is one. base32 can't convert 
anything, so it stops right away. base64 can convert the 'inva' as 
that's valid base64 input, so it outputs the converted data before 
finding the "lid\n" which is invalid.




Added tag(s) notabug. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Fri, 08 Aug 2025 06:40:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 79184 <at> debbugs.gnu.org and Daniel Hofstetter <dhofstet <at> gmail.com> Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Fri, 08 Aug 2025 06:40:02 GMT) Full text and rfc822 format available.

This bug report was last modified 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.