Skip to content

Commit

Permalink
Merge pull request #1049 from pimoroni/patch-pixel-span
Browse files Browse the repository at this point in the history
PicoGraphics: Fix overflow bug in p4 pixel span.
  • Loading branch information
Gadgetoid authored Jan 15, 2025
2 parents a90abba + 19689b4 commit d014b28
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libraries/pico_graphics/pico_graphics_pen_p4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ namespace pimoroni {
}

void PicoGraphics_PenP4::set_pixel_span(const Point &p, uint l) {
// prevent a zero length span causing an overflow in 'l'
// and trying to write 2GB of pixels.
if (l == 0) {return;}

auto i = (p.x + p.y * bounds.w);

// pointer to byte in framebuffer that contains this pixel
Expand Down

0 comments on commit d014b28

Please sign in to comment.