* src/md5sum.c (split_3): Ensure we don't walk off
the end of the string.
* tests/misc/b2sum.sh: Add test cases.
Fixes https://bugs.gnu.org/28860
** Bug fixes
+ b2sum no longer crashes when processing certain truncated check files.
+ [bug introduced with b2sum coreutils-8.26]
+
ptx -S no longer infloops for a pattern which returns zero-length matches.
[the bug dates back to the initial implementation]
#if HASH_ALGO_BLAKE2
/* Terminate and match algorithm name. */
char const *algo_name = &s[i - algo_name_len];
- while (! ISWHITE (s[i]) && s[i] != '-' && s[i] != '(')
+ /* Skip algorithm variants. */
+ while (s[i] && ! ISWHITE (s[i]) && s[i] != '-' && s[i] != '(')
++i;
bool length_specified = s[i] == '-';
bool openssl_format = s[i] == '('; /* and no length_specified */
printf '%s\n' '796485dd32fe9b754ea5fd6c721271d9 check.vals' > exp
compare exp out || fail=1
+# This would segfault from coreutils-8.26 to coreutils-8.28
+printf '%s\n' 'BLAKE2' 'BLAKE2b' 'BLAKE2-' 'BLAKE2(' 'BLAKE2 (' > crash.check \
+ || framework_failure_
+returns_ 1 b2sum -c crash.check || fail=1
+
Exit $fail