Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix definition of NSOperatingSystemVersion #3557

Merged
merged 2 commits into from
Mar 6, 2023

Conversation

grovesNL
Copy link
Collaborator

@grovesNL grovesNL commented Mar 4, 2023

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections
Fixes #3556

Description
The NSOperatingSystemVersion struct is defined by Apple and doesn't contain an is_mac flag, so the existing cast in msg_send![process_info, operatingSystemVersion] is invalid.

Testing
Untested

grovesNL added 2 commits March 3, 2023 23:47
The `NSOperatingSystemVersion` struct doesn't contain an `is_mac` flag,
so the cast in `msg_send![process_info, operatingSystemVersion]` is
invalid.
@jinleili
Copy link
Contributor

jinleili commented Mar 5, 2023

Tested on M1 Mac and everything works fine. But strangely I can't reproduce the issue in #3556, the is_mac field was added a year ago and I haven't had similar problems on my M1/Interl Mac and iPhone 6/12.

@grovesNL
Copy link
Collaborator Author

grovesNL commented Mar 5, 2023

@jinleili thank you for testing this change! The extra is_mac field causes the cast to try to perform an out-of-bounds read (i.e., beyond the end of the NSOperatingSystemVersion struct), so whether it crashes depends on whatever is located after that struct in memory at the time.

@cwfitzgerald cwfitzgerald merged commit 2eb27f2 into gfx-rs:master Mar 6, 2023
@cwfitzgerald cwfitzgerald added the PR: needs back-porting PR with a fix that needs to land on crates label Mar 6, 2023
cwfitzgerald pushed a commit to cwfitzgerald/wgpu that referenced this pull request Mar 9, 2023
@cwfitzgerald cwfitzgerald removed the PR: needs back-porting PR with a fix that needs to land on crates label Mar 22, 2023
xiaopengli89 added a commit to xiaopengli89/wgpu that referenced this pull request Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Intermittent panic getting adapter when running Bevy example
3 participants