Skip to content

Conversation

@dxur
Copy link
Contributor

@dxur dxur commented Oct 18, 2025

When calling update with an empty buffer and width = height = 0 the program segfault

use minifb::{Key, Window, WindowOptions};

const WIDTH: usize = 640;
const HEIGHT: usize = 360;

fn main() {
    let mut buffer = Vec::<u32>::new();

    let mut window = Window::new(
        "Test - ESC to exit",
        WIDTH,
        HEIGHT,
        WindowOptions::default(),
    )
    .unwrap();

    window.update_with_buffer(&buffer, 0, 0).unwrap();
}

Output: fish: Job 1, 'cargo run' terminated by signal SIGSEGV (Address boundary error)

@emoon emoon self-requested a review October 18, 2025 18:12
@emoon emoon self-assigned this Oct 18, 2025
@emoon emoon added the bug label Oct 18, 2025
@emoon emoon merged commit 4910569 into emoon:master Oct 18, 2025
4 checks passed
@emoon
Copy link
Owner

emoon commented Oct 18, 2025

Thanks!

@dxur dxur deleted the fix/segfault branch October 18, 2025 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants