mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
basenc: fix stripping of '=' chars in some encodings
* src/basenc.c (do_decode): With -i ensure we strip '=' chars if there is no padding for the chosen encoding. * tests/basenc/basenc.pl: Add a test case. * NEWS: Mention the bug fix.
This commit is contained in:
1 parent
13202995ba
commit
c480428e37
3 files changed
+7
-1
No files matched your search
@@ -12,6 +12,10 @@ GNU coreutils NEWS -*- outline -*-
|
||||
|
||||
** Bug fixes
|
||||
|
||||
'basenc -d -i' will now strip '=' characters from the input
|
||||
in encodings where padding characters are not valid.
|
||||
[bug introduced with the basenc program in coreutils-8.31]
|
||||
|
||||
cksum was not compilable by Apple LLVM 10.0.0 x86-64, which
|
||||
lacks support for checking for the VPCLMULQDQ instruction.
|
||||
[bug introduced in coreutils-9.6]
|
||||
|
||||
+2
-1
@@ -1159,7 +1159,8 @@ do_decode (FILE *in, char const *infile, FILE *out, bool ignore_garbage)
|
||||
{
|
||||
for (idx_t i = 0; n > 0 && i < n;)
|
||||
{
|
||||
if (isubase (inbuf[sum + i]) || inbuf[sum + i] == '=')
|
||||
if (isubase (inbuf[sum + i])
|
||||
|| (REQUIRED_PADDING (1) && inbuf[sum + i] == '='))
|
||||
i++;
|
||||
else
|
||||
memmove (inbuf + sum + i, inbuf + sum + i + 1, --n - i);
|
||||
|
||||
@@ -168,6 +168,7 @@ my @Tests =
|
||||
['b2m_2', '--base2m -d', {IN=>'11000001'}, {OUT=>"\xC1"}],
|
||||
['b2m_3', '--base2m -d', {IN=>"110\n00001"}, {OUT=>"\xC1"}],
|
||||
['b2m_4', '--base2m -di', {IN=>"110x00001"}, {OUT=>"\xC1"}],
|
||||
['b2m_4p', '--base2m -di', {IN=>"=11000001="}, {OUT=>"\xC1"}],
|
||||
['b2m_5', '--base2m -d', {IN=>"110x00001"}, {EXIT=>1},
|
||||
{ERR=>"$prog: invalid input\n"}],
|
||||
['b2m_6', '--base2m -d', {IN=>"11000001x"}, {OUT=>"\xC1"}, {EXIT=>1},
|
||||
|
||||
Reference in new issue
Block a user