fix(framebuffer): check width, height and implement proper checking when accessing pixels

This commit is contained in:
2025-10-24 19:44:26 -07:00
parent 2253fa2a1f
commit e243228f15
2 changed files with 18 additions and 6 deletions

View File

@@ -120,7 +120,8 @@ fn draw(image: DynamicImage) -> Result<()> {
let image = resize_to_fit(&image, fit);
// Create a framebuffer to draw the image on.
let mut framebuffer = Framebuffer::new(width, height);
let mut framebuffer =
Framebuffer::new(width, height).context("unable to create framebuffer")?;
// Iterate over the pixels in the image and put them on the framebuffer.
for (x, y, pixel) in image.enumerate_pixels() {