protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Invalid argument to setlocale in stringprintf_unittest.cc

Open VemundH opened this issue 6 years ago • 1 comments

What version of protobuf and what language are you using? Version: 3.11.1 Language: C++

What operating system (Linux, Windows, ...) and version? Windows

What runtime / compiler are you using (e.g., python version or gcc version) Visual Studio 2019

What did you do? Compile - debug build run tests

What did you expect to see No test failures

What did you see instead? Stops due to debug assertion in setlocale call

Problem in src/google/protobuf/stubs/stringprintf_unittest.cc Two occurrences of code like this:

char* old_locale = setlocale(LC_CTYPE, nullptr);
setlocale(LC_CTYPE, "en_US.utf8"); // invalidates old_locale here
...
setlocale(LC_CTYPE, old_locale); // assertion failure

VemundH avatar Dec 06 '19 13:12 VemundH

What debug assertion are you seeing?

jorgbrown avatar Sep 01 '22 18:09 jorgbrown

Looks like this was fixed in #8735

VemundH avatar Oct 23 '22 16:10 VemundH