office-gobmx/external/boost/windows-no-utf8-locales.patch.0
Mike Kaganski 072a25e1ef tdf#157135 workaround: restore and update windows-no-utf8-locales.patch.0
This partially reverts commit ed259e5efe
(Upgrade external/boost to latest Boost 1.81.0, 2023-01-05), which had
dropped the patch previously introduced with commit
f046fed278 (Don't ever attempt to initialise
a std::locale with a UTF-8 locale on Windows, 2018-05-17).

It seems that there is a nightmare going on in MSVCRT, and tdf#157135
is caused by dome MS bug. The problem happens in a deeply nested call
to mbstowcs_s (several levels deep from std::locale constructor with
name of "en_US.UTF-8"), which gets a non-null wcstr and sizeInWords
equal to zero, which generates an invalid argument handler, resulting
in a failed assertion "(pwcs == nullptr && sizeInWords == 0) || (pwcs
!= nullptr && sizeInWords > 0)" in _mbstowcs_internal from
minkernel\crts\ucrt\src\appcrt\convert\mbstowcs.cpp:245, and a crash.
The crashreporter initiates, but since it tries to use CRT itself,
which is in fastfail mode, it hangs.

The patch that is restored here was intended for something different;
but it happily workarounds the nightmare. Until the proper fix found,
let it be.

Change-Id: Ic978f87e2e7b81fc2e1cd182a4247084ad016a9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164068
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-28 04:57:11 +01:00

23 lines
837 B
Diff

Don't ever attempt to initialise a std::locale with a UTF-8 locale on Windows -*- Mode: Diff -*-
--- libs/locale/src/boost/locale/std/std_backend.cpp
+++ libs/locale/src/boost/locale/std/std_backend.cpp
@@ -86,6 +86,7 @@
#endif
utf_mode_ = utf8_support::none;
} else {
+ #if !defined(BOOST_WINDOWS)
if(loadable(lid)) {
name_ = lid;
utf_mode_ = utf8_support::native_with_wide;
@@ -98,8 +99,8 @@
utf_mode_ = utf8_support::from_wide;
#endif
}
-#if defined(BOOST_WINDOWS)
- else if(loadable(win_name))
+ #else
+ if(loadable(win_name))
{
name_ = win_name;
utf_mode_ = utf8_support::from_wide;