The mapfile builtin command doesn't correctly strip delimiters (when requested with the -t option) in all cases.
unicorn:~$ echo "$BASH_VERSION" 5.1.4(1)-release unicorn:~$ printf $'a\xffb\xffc\xff' | { mapfile -t -d $'\xff' array; declare -p array; } declare -a array=([0]=$'a\377' [1]=$'b\377' [2]=$'c\377') I expected the \377 delimiters to be removed by the -t option. Other delimiters that I tried, which also fail (aren't removed by -t) are $'\xfe', $'\xf0', $'\x81' and $'\x80'. Delimiters which work (are removed by -t) include 'q', $'\x01' and $'\x7f'. At this point, it looks like any byte with the most significant bit set triggers the error. Additional info: unicorn:~$ locale LANG=en_US.utf8 LANGUAGE= LC_CTYPE="en_US.utf8" LC_NUMERIC="en_US.utf8" LC_TIME=C LC_COLLATE="en_US.utf8" LC_MONETARY="en_US.utf8" LC_MESSAGES="en_US.utf8" LC_PAPER="en_US.utf8" LC_NAME="en_US.utf8" LC_ADDRESS="en_US.utf8" LC_TELEPHONE="en_US.utf8" LC_MEASUREMENT="en_US.utf8" LC_IDENTIFICATION="en_US.utf8" LC_ALL= unicorn:~$ uname -a Linux unicorn 5.10.0-8-amd64 #1 SMP Debian 5.10.46-5 (2021-09-23) x86_64 GNU/Linux unicorn:~$ cat /etc/debian_version 11.0 unicorn:~$ dpkg -l bash | tail -n1 ii bash 5.1-2+b3 amd64 GNU Bourne Again SHell