numworks / epsilon-sample-app-rust

A sample Rust app for the NumWorks graphing calculator
BSD 3-Clause "New" or "Revised" License
50 stars 11 forks source link

can't draw rectangles with more than 65637 pixels on Epsilon 18.2.0? #20

Open LoucaFrss opened 1 year ago

LoucaFrss commented 1 year ago

Hello, I was trying to display an image on the whole calculator screen, but strange things happened, sometimes the numworks crashed, other times I couldn't restart the app because "exam mode was enabled" (I never enabled it), so I tried to figure out where this bug came from and found that if I tried to draw a rectangle with push_rect(rect: Rect, pixels: &[Color]) with more than 65637 white pixels (which is very close to 2^16) , the calculator was crashing, the same thing with more pixels with random colors created weird things like enabling the exam mode or crash when starting other applications. here is the code:

#[no_mangle]
pub fn main() {
    push_rect(
        Rect {
            x: 0,
            y: 0,
            width: 10,
            height: 10,
        },
        &[Color { rgb565: u16::MAX }; 65637],
    );
}

(The only things I changed other than this are adding #[derive(Clone, Copy) to Color and the build.rs and .cargo/config files)

I don't know much about how numworks works, but I found this bug quite weird and I didn't see any issue about it on the different numworks github repositories is this normal? is there a fix?