Data returned from Xlib/XGetEventData is not guaranteed to be aligned#610
Merged
not-fl3 merged 1 commit intonot-fl3:masterfrom Mar 22, 2026
Merged
Data returned from Xlib/XGetEventData is not guaranteed to be aligned#610not-fl3 merged 1 commit intonot-fl3:masterfrom
not-fl3 merged 1 commit intonot-fl3:masterfrom
Conversation
Owner
|
Thanks for PR! |
Contributor
Author
|
Thanks for merging! |
Contributor
|
When reading Probably could just do the following? let dx = std::ptr::read_unaligned((*raw_event).raw_values);
let dy = std::ptr::read_unaligned((*raw_event).raw_values.add(1)); |
Contributor
Author
|
Thanks for pointing this out! Thought I properly tested this on X11, but my system is still running Wayland apparently. I'll make a fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #394
Data returned from Xlib is not guaranteed to be aligned. This could cause a "misaligned pointer deference" panic when getting the mouse deltas. The mouse deltas are two doubles, but the buffer in which they are stored might not be 8 byte aligned. This apparently could happen quite easily on a Linux 32 bit system.
Tested it on a 32bit Raspberry PI. Also tested this on a Ubuntu 64bit, just to see It didn't break anything there.