From 0e778cf16dbd5e2b1f1e2c23e082659d6ab7943c Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Wed, 27 Apr 2022 13:17:20 +0200 Subject: [PATCH] fix(core): fix display_icon function - incorrect boundaries checks --- core/embed/extmod/modtrezorui/display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/embed/extmod/modtrezorui/display.c b/core/embed/extmod/modtrezorui/display.c index 7e4944c77..022cca6dc 100644 --- a/core/embed/extmod/modtrezorui/display.c +++ b/core/embed/extmod/modtrezorui/display.c @@ -386,8 +386,8 @@ void display_icon(int x, int y, int w, int h, const void *data, int st = uzlib_uncompress(&decomp); if (st == TINF_DONE) break; // all OK if (st < 0) break; // error - const int px = pos % w; - const int py = pos / w; + const int px = (pos * 2) % w; + const int py = (pos * 2) / w; if (px >= x0 && px <= x1 && py >= y0 && py <= y1) { PIXELDATA(colortable[decomp_out >> 4]); PIXELDATA(colortable[decomp_out & 0x0F]);