From 1c9fc51d01e3f5579b25f4b291b4fa01fdd83faf Mon Sep 17 00:00:00 2001 From: shylie Date: Wed, 4 Jun 2025 20:09:43 -0400 Subject: [PATCH] Fix out-of-bounds access --- src/picoled.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/picoled.cpp b/src/picoled.cpp index dc95ec0..beabab1 100644 --- a/src/picoled.cpp +++ b/src/picoled.cpp @@ -16,6 +16,8 @@ oled::~oled() pixel& oled::operator()(int x, int y) { + static pixel dummy; + if (x < 0 || x >= width || y < 0 || y >= height) { return dummy; } return pixels[x + y * width]; }