From d8e06d487b7ff9f6cfa0c42744f11f4c0d7fe830 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 24 Jul 2020 15:55:51 +0200 Subject: [PATCH] core/protobuf: use utils.decode_bytes --- core/src/protobuf.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/protobuf.py b/core/src/protobuf.py index 40c93dc6c..ce3176f31 100644 --- a/core/src/protobuf.py +++ b/core/src/protobuf.py @@ -5,6 +5,8 @@ bytes, string, embedded message and repeated fields. from micropython import const +from trezor.utils import decode_bytes + if False: from typing import Any, Dict, Iterable, List, Tuple, Type, TypeVar, Union from typing_extensions import Protocol @@ -257,7 +259,7 @@ def load_message( elif ftype is UnicodeType: fvalue = bytearray(ivalue) reader.readinto(fvalue) - fvalue = bytes(fvalue).decode() + fvalue = decode_bytes(fvalue) elif issubclass(ftype, MessageType): fvalue = load_message(LimitedReader(reader, ivalue), ftype, field_cache) else: