Subject: bug#38299: A bug while trying to decode a non encode base64

From: vardhaman narasagoudar <[email-masked]>
Date: Thu, 21 Nov 2019 12:04:11 +0530

Hi Team,

Thanks for replying the query, but if I check online (
https://www.base64decode.org/) for decoding  the same in online .

I get  an error  message (which is valid) e.g:-

1) if I try to decode "777799"  I get an error message

"No printable characters found, try another source charset, or upload your
data as a file for binary decoding."

Similarly we got return code as 1 "invalid input" in the terminal.

2) Now if I try to decode "vardhamanbn1" I get the error message  (any 12
characters or multiple of 12 characters which is a non-encoded value, if
try to decode)
"No printable characters found, try another source charset, or upload your
data as a file for binary decoding."

But when we try the same in terminal , we get the return code as 0 the
symbol as per inputs given
 "UTF-8 and thus leads to �."

Now as a work around we are using
a) [vardhaman@oc6085028360 ~]$ echo -n "vardhamanbn1" | base64 -d | iconv
-f utf8
iconv: illegal input sequence at position 0

also we tried on another sample

b) [vardhaman@oc6085028360 ~]$ echo  -n '777799' | base64 -d | iconv -f utf8
base64: invalid input
iconv: illegal input sequence at position 0

without using "iconv -f utf8"

[vardhaman@oc6085028360 ~]$  echo  -n '777799' | base64 -d
����base64: invalid input

So we feel its something still with 12 & multiple of 12 characters leading
to the issue, when we try to decode a non-decode value.
Or should we think characters of multiple of 12 will be treated as a base64
format

 e.g when I tried decoding 24 non-encode character:-
 [vardhaman@oc6085028360 ~]$ echo -n 'vardhamanbn1vardhamanbn1' | base64
--decode
��݅�������݅�����[vardhaman@oc6085028360 ~]$ echo $?
0

On Thu, Nov 21, 2019 at 12:51 AM Paul Eggert <[email-masked]> wrote:

> On 11/20/19 6:22 AM, Martin Schulte wrote:
> > vardhamanbn1 is a valid encoding
>
> Thanks for explaining; closing the bug report.
>

-- 
Thanks & Regards
Vardhaman B.N