Skip to content

Invalid argument to setlocale in stringprintf_unittest.cc #6993

Closed
@VemundH

Description

@VemundH

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions