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
Environment_WIN32U nodeIdImpl access violation in 1.13.0 #4392
Comments
Can you send the length returned by the first That'll be the value in |
|
I believe this is some sort of packing issue. On the default packing the winnt.h contains the following assert, which verifies that the default packing option is used. Unfortunately it appears that this assert doesn't happen for other headers, such as static_assert(__alignof(LARGE_INTEGER) == 8, "Windows headers require the default packing option. Changing this can lead to memory corruption."
" This diagnostic can be disabled by building with WINDOWS_IGNORE_PACKING_MISMATCH defined."); 648 appears to be the correct size for x86. I can't find a way to get that size for x64. Even forcing |
Apologies, I've clarified the environment in my original comment - the project configuration is indeed x86 |
According to this page on
I'm not sure if For me: without |
It should be set for this case only, and then unset (if it wasn't set to start with) to prevent it from causing some unforeseen problems elsewhere |
Page https://learn.microsoft.com/en-us/windows/win32/api/iptypes/ns-iptypes-ip_adapter_info contains remarks:
Proper solution in the long term might be to use |
I wanted to fix this problem in PR #4405 to set compile-time define to a single file when compiling on 32-bit Windows. That solution is suboptimal and hacky. Function @andrewauclair, would you be willing to rewrite the function Windows variant of |
@matejk Sure I'll check it out this week. It's sounding like that's the better long-term solution here. I do agree with Microsoft on this. As of a few days ago there's less than 14 years left to 32 bit Edit: 2038 - 2024 is 14 years, not 4. I've been sick for a few days and it's not helping my brain right now. |
Is |
We don't really have an option, IMO. The temporary buffer is released each time anyway. Are you concerned about memory usage? 20kB shall not be a problem on a Windows machine I think. |
You're right, it probably doesn't matter, and we have to do it. Hoping to put together a PR this weekend. Through a lot of experimenting, I learned that we can't allocate an array of the struct, we need to allocate an array of bytes like before. |
Example on MS web site can be easily adapted, I think. |
Describe the bug
After upgrading from 1.12.4 to 1.13.0, in Environment_WIN32U.cpp the EnvironmentImpl::nodeIdImpl function throws an access violation when making the second call to GetAdaptersInfo if the first call has returned 111 (ERROR_BUFFER_OVERFLOW)
This appears to have been introduced in #4328 (#4336, cfc9ce3).
Expected behavior
Same behaviour as 1.12.4
Please add relevant environment information:
The text was updated successfully, but these errors were encountered: