graphics-server: bounds-check the circle drawing

Otherwise we could overflow the buffer.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2020-11-23 19:31:52 +08:00
parent 8270283868
commit 0732075869

View file

@ -280,6 +280,9 @@ fn line_fill_padded_border(fb: &mut LcdFB, y: usize) {
}
fn put_pixel(fb: &mut LcdFB, x: usize, y: usize, color: PixelColor) {
if (x >= LCD_PX_PER_LINE) || (y >= LCD_LINES) {
return;
}
if color == PixelColor::Off {
fb[(x + y * LCD_WORDS_PER_LINE * 32) / 32] |= 1 << (x % 32)
} else {