-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
Error in StringPrintfTest.Multibyte with Visual Studio 2019 16.4.1 x64 #7074
Comments
Anyone? |
I get the same Assertion. |
I get the same assertion in VS 2015 on 3.2.0 and 3.3.0. Did not get it in 2017. |
I can still reproduce this issue with protobuf 3.13.0 in Visual Studio 2019 16.8 x64:
Could this be looked at? It seems a bit scary if multi-byte character conversions are potentially broken... |
Merged
florin-crisan
added a commit
to florin-crisan/protobuf
that referenced
this issue
Jun 15, 2021
`setlocale` returns a pointer to a buffer containing the current locale name. This needs to be copied into a `std::string` or it will be overwritten by the next call. Trying to call `setlocale` with a non-null, invalid pointer can have unpredictable results, such as ``` [ RUN ] StringPrintfTest.Multibyte minkernel\crts\ucrt\src\appcrt\convert\mbstowcs.cpp(246) : Assertion failed: (pwcs == nullptr && sizeInWords == 0) || (pwcs != nullptr && sizeInWords > 0) ``` `setlocale` can also return a `nullptr` if it fails, but we assert against that.
florin-crisan
added a commit
to florin-crisan/protobuf
that referenced
this issue
Jul 5, 2021
`setlocale` returns a pointer to a buffer containing the current locale name. This needs to be copied into a `std::string` or it will be overwritten by the next call. Trying to call `setlocale` with a non-null, invalid pointer can have unpredictable results, such as ``` [ RUN ] StringPrintfTest.Multibyte minkernel\crts\ucrt\src\appcrt\convert\mbstowcs.cpp(246) : Assertion failed: (pwcs == nullptr && sizeInWords == 0) || (pwcs != nullptr && sizeInWords > 0) ``` `setlocale` can also return a `nullptr` if it fails, but we assert against that.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When running the tests I get a reproducible assertion in StringPrintfTest.Multibyte on a Visual Studio 2019 16.4.1 x64 build. All other platforms (Ubuntu 18.04, CentOS 7.7, macOS XCode 9, Windows Visual Studio 2017.9) work fine with the same build instructions.
Version: v3.11.2
Windows 10, Visual Studio 2019 16.4.1 x64
CMake 3.16.1, Google Test 1.10.0
The text was updated successfully, but these errors were encountered: