-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Fix getting/setting huge env vars on windows #12396
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
Conversation
On windows, the GetEnvironmentVariable function will return the necessary buffer size if the buffer provided was too small. This case previously fell through the checks inside of fill_utf16_buf_and_decode, tripping an assertion in the `slice` method. This adds an extra case for when the return value is >= the buffer size, in which case we assume the return value as the new buffer size and try again. Closes rust-lang#12376
LGTM |
One of the Windows functions called using |
It sounds like so long as we use the return value as the next length, we'll have the right sized buffer. |
@alexcrichton Yes, my concern does not impact this particular PR. I was looking at it to find out the reasoning for the |
(I've removed my r+, just in case.) |
@kballard, thanks! |
On windows, the GetEnvironmentVariable function will return the necessary buffer size if the buffer provided was too small. This case previously fell through the checks inside of fill_utf16_buf_and_decode, tripping an assertion in the `slice` method. This adds an extra case for when the return value is >= the buffer size, in which case we assume the return value as the new buffer size and try again. Closes #12376
On windows, the GetEnvironmentVariable function will return the necessary buffer
size if the buffer provided was too small. This case previously fell through the
checks inside of fill_utf16_buf_and_decode, tripping an assertion in the
slice
method.
This adds an extra case for when the return value is >= the buffer size, in
which case we assume the return value as the new buffer size and try again.
Closes #12376