lcd: Fix incorrect use of LCD_STRIDEFORMAT for remote LCDs
The get_address_fn implementations for some remote LCDs were checking LCD_STRIDEFORMAT unconditionally, but that macro is only valid for the main LCD. The remote LCD code only supports horizontal strides, so when compiling for a remote LCD, force the use of horizontal stride addressing. This fixes a buffer overflow and out of bounds write that occurs with the M:Robe 500 remote LCD. (Tested with sim + ASan only.) Change-Id: I99c6aa11d38f5105b096fc448948b9ec1b27dfe6
This commit is contained in:
parent
f373c97c90
commit
3bc6408bbe
2 changed files with 2 additions and 2 deletions
|
@ -83,7 +83,7 @@ static void *LCDFN(frameaddress_default)(int x, int y)
|
|||
{
|
||||
/* the default expects a buffer the same size as the screen */
|
||||
struct frame_buffer_t *fb = CURRENT_VP->buffer;
|
||||
#if LCD_STRIDEFORMAT == VERTICAL_STRIDE
|
||||
#if defined(MAIN_LCD) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
|
||||
size_t element = (x * LCDM(NATIVE_STRIDE)(fb->stride)) + y;
|
||||
#else
|
||||
size_t element = (y * LCDM(NATIVE_STRIDE)(fb->stride)) + x;
|
||||
|
|
|
@ -95,7 +95,7 @@ static void *LCDFN(frameaddress_default)(int x, int y)
|
|||
{
|
||||
/* the default expects a buffer the same size as the screen */
|
||||
struct frame_buffer_t *fb = CURRENT_VP->buffer;
|
||||
#if LCD_STRIDEFORMAT == VERTICAL_STRIDE
|
||||
#if defined(MAIN_LCD) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
|
||||
size_t element = (x * LCDM(NATIVE_STRIDE)(fb->stride)) + y;
|
||||
#else
|
||||
size_t element = (y * LCDM(NATIVE_STRIDE)(fb->stride)) + x;
|
||||
|
|
Loading…
Reference in a new issue