From 38ad9ab9e58474f56c0ff922717db8a6f3a4c2f6 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sat, 7 May 2022 16:27:13 +0200 Subject: [PATCH] fix(python): only even-width grayscale icons are supported [no changelog] --- python/src/trezorlib/toif.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/src/trezorlib/toif.py b/python/src/trezorlib/toif.py index 43e52f0e0..2c397b7f5 100644 --- a/python/src/trezorlib/toif.py +++ b/python/src/trezorlib/toif.py @@ -155,6 +155,8 @@ def from_image( if image.mode == "L": toif_mode = firmware.ToifMode.grayscale + if image.size[0] % 2 != 0: + raise ValueError("Only even-width grayscale images are supported") toif_data = _from_pil_grayscale(image.getdata()) elif image.mode == "RGB": toif_mode = firmware.ToifMode.full_color