-
Notifications
You must be signed in to change notification settings - Fork 19
Remove an incorrect use of the address operator #65
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
Remove an incorrect use of the address operator #65
Conversation
The address of the local variable created_threads is a different location than the data it points to. Incorrectly treating these values as being the same can cause out-of-bounds writes to the stack. Resolves facebook#59
|
I'm guessing the |
|
Since this a bug fix, can you provide the before and after test outcome following the forced usage of alloca here? |
I wasn't able to reproduce a warning with just the change in that issue comment. However, by removing the cast, a warning is generated |
Under what setup do you see this warning? My gcc 11.5.0 does not give any warning. I was able to reproduce the failing tests with these commands: With this patch, I don't see the error anymore. But if the warning you show is real, it may be breaking some other compatibilities. |
Sorry, I think I misunderstood your previous request. What I did was probably not so interesting: I modified the base revision removing the
Okay, without the PR, when I add or a related test crash With this PR, no tests crash. As an aside, according to the documentation, MSVC defines |
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.
Great! Now that we can confirm the this PR indeed fixes the bug as expected and from what I can see, there should be no side effects on environment where __STDC_NO_VLA__ is not defined (all-green CIs confirm that).
The address of the local variable created_threads is a different location than the data it points to. Incorrectly treating these values as being the same can cause out-of-bounds writes to the stack.
Resolves #59