boostorg / regex

Boost.org regex module
http://boost.org/libs/regex
84 stars 91 forks source link

Assertion failure on Windows 10 if the default region/language setting is "mixed" (e.g. English / Germany) #114

Open nwu-ableton opened 4 years ago

nwu-ableton commented 4 years ago

Summary

The following program aborts with an assertion failure on Windows 10 if the default language/region is set to English/Germany:

#include <boost/regex.hpp>

int main()
{
  auto regex = boost::regex{""};
}

Assertion:

Assertion failed: r != 0, file libs\regex\build\..\src\w32_regex_traits.cpp, line 125

The assertion does not happen if the language/region is set to English/United States.

Also see this StackOverflow thread for another example of someone encountering this issue.

Details

Boost version

Boost version: 1.74.0, as downloaded from sourceforge Binaries: boost_regex-vc142-mt-gd-x64-1_74.lib/.dll from lib64-msvc-14.2 directory

Operating system

Edition: Windows 10 Pro for Workstations System type: 64-bit operating system Version: 1809 OS build: 17763.1397

Compiler & flags

Edition: Microsoft Visual Studio Professional 2019 Version: 16.7.3

Compiler flags/project settings set to the default for a newly created blank C++ project in VS 2019, aside from adding the BOOST_ALL_NO_LIB define and adding the necessary include path and lib file to compile the code.

The resulting compiler command line arguments are:

/JMC /permissive- /GS /W3 /Zc:wchar_t /ZI /Gm- /Od /sdl /Fd"x64\Debug\vc142.pdb" /Zc:inline /fp:precise /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /MDd /FC /Fa"x64\Debug\" /EHsc /nologo /Fo"x64\Debug\" /Fp"x64\Debug\LocaleTest.pch" /diagnostics:column 

Linker command line arguments:

/OUT:"C:\Users\nwu\source\repos\LocaleTest\x64\Debug\LocaleTest.exe" /MANIFEST /NXCOMPAT /PDB:"C:\Users\nwu\source\repos\LocaleTest\x64\Debug\LocaleTest.pdb" /DYNAMICBASE "C:\Dev\boost_1_74_0-bin-msvc-all-32-64\boost_1_74_0\lib64-msvc-14.2\boost_regex-vc142-mt-gd-x64-1_74.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X64 /INCREMENTAL /PGD:"C:\Users\nwu\source\repos\LocaleTest\x64\Debug\LocaleTest.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Debug\LocaleTest.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /TLBID:1 

Language settings

Problematic settings (assertion triggered)

image

Working settings (no assertion)

image

pshurgal commented 4 months ago

I have the same issue with English/Lithuanian language. The function LCMapStringA fails with ERROR_INSUFFICIENT_BUFFER. If I increase the buffer m_lower_map 4 times the function LCMapStringA returns number 512