Correct Sprite odd pixel count width crash
The 32 bit alignment offset must be checked for every line to prevent crash with odd pixel count lines.
This commit is contained in:
parent
6b924c5504
commit
9d2c7f21fc
|
|
@ -562,13 +562,14 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
|
|||
|
||||
data += dx + dy * w;
|
||||
|
||||
// Check alignment of pointer to 32 bits
|
||||
uint8_t offset = (uint32_t)data & 0x3;
|
||||
dw <<= 1;
|
||||
if (offset > dw) offset = dw;
|
||||
|
||||
while (dh--)
|
||||
{
|
||||
// Check alignment of pointer to 32 bits
|
||||
uint8_t offset = (uint32_t)data & 0x3;
|
||||
if (offset > dw) offset = dw;
|
||||
|
||||
int32_t len = dw;
|
||||
uint8_t* ptr = (uint8_t*)data;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue