Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2021-04-22 18:31:27 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-04-22 18:31:27 +0300
commit91546ca4ca413d38642850e56b4468c1b247bb24 (patch)
treee50b20a9fb59ef617904d66b84a8580ee1f9aa61 /src/Display
parent79a3243c22632c117f7ce4612002d6989ec99d1c (diff)
Avoid writing images beyond the last row of the display3.3beta3
Diffstat (limited to 'src/Display')
-rw-r--r--src/Display/Lcd/Lcd.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Display/Lcd/Lcd.cpp b/src/Display/Lcd/Lcd.cpp
index a472d6e2..303a3bf5 100644
--- a/src/Display/Lcd/Lcd.cpp
+++ b/src/Display/Lcd/Lcd.cpp
@@ -525,7 +525,7 @@ void Lcd::Bitmap(PixelNumber x0, PixelNumber y0, PixelNumber width, PixelNumber
// Draw a single bitmap row. 'left' and 'width' do not need to be divisible by 8.
void Lcd::BitmapRow(PixelNumber top, PixelNumber left, PixelNumber width, const uint8_t data[], bool invert) noexcept
{
- if (width != 0) // avoid possible arithmetic underflow
+ if (width != 0 && top < numRows) // avoid possible arithmetic underflow or overflowing the buffer
{
const uint8_t inv = (invert) ? 0xFF : 0;
uint8_t firstColIndex = left/8; // column index of the first byte to write