-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Speculative fix for alignment crash in directory iterator on Windows #10628
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is an insane bug
i left some ocmments
const dir_info: FILE_DIRECTORY_INFORMATION_PTR = @ptrCast(@alignCast(&self.buf[self.index])); | ||
if (dir_info.NextEntryOffset != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the struct is unaligned, even if we cast alignment, do we have to worry about unaligned reads? Technically that is undefined behavior right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the expected alignment is 2 but the alignment we're seeing is 8, then it is also 2 so that should be okay
What does this PR do?
We've received about 16 crash reports for an alignment issue in the directory iterator code
So let's loosen the alignment requirements here and see if it goes away
See also: ziglang/zig#17958
How did you verify your code works?