Skip to content

Commit d014b28

Browse files
authored
Merge pull request #1049 from pimoroni/patch-pixel-span
PicoGraphics: Fix overflow bug in p4 pixel span.
2 parents a90abba + 19689b4 commit d014b28

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libraries/pico_graphics/pico_graphics_pen_p4.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ namespace pimoroni {
7070
}
7171

7272
void PicoGraphics_PenP4::set_pixel_span(const Point &p, uint l) {
73+
// prevent a zero length span causing an overflow in 'l'
74+
// and trying to write 2GB of pixels.
75+
if (l == 0) {return;}
76+
7377
auto i = (p.x + p.y * bounds.w);
7478

7579
// pointer to byte in framebuffer that contains this pixel

0 commit comments

Comments
 (0)