From 85fbbd9c7f3e1ac84910a16095a297cbe13a8123 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sat, 17 Apr 2021 00:37:11 -0400 Subject: 16 bit lcd_mono_bitmap 'Bugfix' mono_bitmap_part reads ahead in the buffer, if the height is <= char bit pixels other memory gets read Change-Id: I6e0d7a9017e1f9c371ffbd56af149ac20cb82341 --- firmware/drivers/lcd-16bit-common.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'firmware') diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c index 49e515f59f..5ec142c855 100644 --- a/firmware/drivers/lcd-16bit-common.c +++ b/firmware/drivers/lcd-16bit-common.c @@ -462,7 +462,14 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, /* Draw a full monochrome bitmap */ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int height) { - lcd_mono_bitmap_part(src, 0, 0, width, x, y, width, height); + int stride = width; + + /* 'Bugfix' mono_bitmap_part reads ahead in the buffer, + * if the height is <= char bit pixels other memory gets read + */ + if (height <= CHAR_BIT) + stride = 0; + lcd_mono_bitmap_part(src, 0, 0, stride, x, y, width, height); } -- cgit v1.2.3