summaryrefslogtreecommitdiff
path: root/b4.sh
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2021-07-18 00:34:05 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-08-03 11:57:44 -0400
commitf6071de6ac07157aeddd19466b5b84449c6ea1b1 (patch)
treecfb9ee5083f2a08292128350440f7df2009b7e9c /b4.sh
parentfb9c3b878d22f6e52285ebbb2c667b979bf13069 (diff)
downloadb4-f6071de6ac07157aeddd19466b5b84449c6ea1b1.tar.gz
Avoid decoding errors when extracting message ID from stdin
The mbox, am, and pr subcommands accept an mbox on stdin and extract the message ID. When stdin.read() is called, Python assumes the encoding is locale.getpreferredencoding(False). This may not match the content encoding, leading to a decoding error. Instead feed the stdin bytes to message_from_bytes(), which leads to a decode('ASCII', errors='surrogateescape') underneath. That's sufficient to get the message ID from the ASCII headers. Reported-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Kyle Meyer <kyle@kyleam.com> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'b4.sh')
0 files changed, 0 insertions, 0 deletions