* src/digest.c (main): Don't saturate -l to BLAKE2B_MAX_LEN,
so that the subsequent bounds check is performed.
* tests/cksum/b2sum.sh: Add a test case.
* NEWS: Mention the fix introduced in commit
v9.5-71-gf2c84fe63
** Bug fixes
+ 'b2sum' will diagnose --length values that are too big.
+ Previously it would have silently assumed 512 for any larger values.
+ [bug introduced in coreutils-9.6]
+
'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]
#endif
#if HASH_ALGO_BLAKE2 || HASH_ALGO_CKSUM
case 'l':
- digest_length = xnumtoumax (optarg, 10, 0, BLAKE2B_MAX_LEN * 8, "",
+ digest_length = xnumtoumax (optarg, 10, 0, UINTMAX_MAX, "",
_("invalid length"), 0,
XTOINT_MAX_QUIET);
digest_length_str = optarg;
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ cksum
+getlimits_
for prog in 'b2sum' 'cksum -a blake2b'; do
# Also check b2sum if built
# Only validate the last specified, used length
$prog -l 123 -l 128 /dev/null || fail=1
+# This would not flag an error in coreutils 9.6 and 9.7
+for len in 513 1024 $UINTMAX_OFLOW; do
+ returns_ 1 $prog -l $len /dev/null 2>err || fail=1
+ progname=$(echo "$prog" | cut -f1 -d' ')
+ cat <<EOF > exp || framework_failure_
+$progname: invalid length: '$len'
+$progname: maximum digest length for 'BLAKE2b' is 512 bits
+EOF
+ compare exp err || fail=1
+done
+
done
Exit $fail