lcd-16bit-common move bugfix to sim only

Ive seen no ill effects having this disabled on target so
limit it to the sim to stop Address Sanitizer from dumping
on the extra byte read. the bad data is never used AFAICT
since the loop ends

Change-Id: I8cb54e9d1f8fe28747867d861a015edb3dbfa5ff
This commit is contained in:
William Wilgus 2021-11-08 17:45:31 -05:00 committed by William Wilgus
parent 8c954c68e5
commit 9f1cab154c

View file

@ -316,6 +316,18 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
x += lcd_current_viewport->x;
y += lcd_current_viewport->y;
/* 'Bugfix' mono_bitmap_part reads ahead in the buffer, While this is a bug
* if the height is <= char bit pixels other memory gets read but is not used
* the other option is to check in the hot code path but this appears
* sufficient, limit to the sim to stop Address Sanitizer errors
*/
#if defined(SIMULATOR) && \
(!defined(LCD_STRIDEFORMAT) || LCD_STRIDEFORMAT != VERTICAL_STRIDE)
/* vertical stride targets don't seem affected by this */
if (height <= CHAR_BIT)
stride = 0;
#endif
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
@ -331,14 +343,6 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
x = 0;
}
/* 'Bugfix' mono_bitmap_part reads ahead in the buffer,
* if the height is <= char bit pixels other memory gets read
* the other option is to check in the hot code path but this appears
* sufficient
*/
if (height <= CHAR_BIT)
stride = 0;
if (y < 0)
{
height += y;