rust-windowing / rust-windowing/winit

Toggle Fullscreen segfaults in application example

Open
#4,480 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

B - bug DS - appkit
Dominant language
Rust
Stars
6.2k
Forks
1.3k
Avg merge
2d 19h
Merged PRs (30d)
9

Description

Description

When running cargo run --example application and toggling fullscreen, the application segfaults with the following logs:

2026-02-08T12:20:33.503457Z  INFO application: User wake up
2026-02-08T12:20:33.579934Z  INFO application: Modifiers changed to ModifiersState(CONTROL)
2026-02-08T12:20:33.659226Z  INFO application: Executing action: ToggleFullscreen

thread 'main' (12295040) panicked at winit/examples/application.rs:975:21:
index out of bounds: the len is 1920000 but the index is 1920000
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2026-02-08T12:20:33.724373Z  INFO application: Application exited
2026-02-08T12:20:33.724518Z ERROR winit_common::event_handler: tried to run event handler, but no handler was set
2026-02-08T12:20:33.749846Z ERROR winit_common::event_handler: tried to run event handler, but no handler was set
[1]    68120 segmentation fault  cargo run --example application

Seems like the buffer size in draw() is being calculated before the resize, leading to index out-of-bounds issue.

Bug exists on macOS, but could also be on Windows and Linux. Don't have them to test.

macOS version
ProductName:            macOS
ProductVersion:         15.6.1
BuildVersion:           24G90
Winit version

0.31-beta2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run cargo run --example application and reproduce the panic by toggling fullscreen. Inspect winit/examples/application.rs around line 975 and trace how draw() calculates its buffer size before and after resizing. Done means fullscreen toggling no longer produces the out-of-bounds panic or subsequent segmentation fault.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.