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:
Bodmer
2017-12-01 15:37:08 +00:00
committed by GitHub
parent 6b924c5504
commit 9d2c7f21fc

View File

@@ -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;