1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-23 04:52:01 +00:00

fix(core/wire): handle codec errors better

This commit is contained in:
matejcik 2021-04-19 16:53:30 +02:00 committed by matejcik
parent 231a1fe229
commit 411a7bb802

View File

@ -406,7 +406,14 @@ async def handle_session(
if next_msg is None:
# If the previous run did not keep an unprocessed message for us,
# wait for a new one coming from the wire.
msg = await ctx.read_from_wire()
try:
msg = await ctx.read_from_wire()
except codec_v1.CodecError as exc:
if __debug__:
log.exception(__name__, exc)
await ctx.write(failure(exc))
continue
else:
# Process the message from previous run.
msg = next_msg