[Boost-bugs] [Boost C++ Libraries] #11848: Win32 backend bug when do wide char convert to multi byte in boost::locale

Subject: [Boost-bugs] [Boost C++ Libraries] #11848: Win32 backend bug when do wide char convert to multi byte in boost::locale
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-12-16 05:26:31


#11848: Win32 backend bug when do wide char convert to multi byte in boost::locale
------------------------------+---------------------
 Reporter: fyrestone@… | Owner: artyom
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: locale
  Version: Boost 1.59.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------
 The function wide_to_multibyte_non_zero in
 locale/src/encoding/wconv_codepage.ipp has bug. This function assume that
 when the codepage is CP_UTF7 or CP_UTF8, the substitute_ptr and
 subst_char_ptr will be 0. But, in x64 Windows 10, I use codepage 54936 get
 87 error code after the first WideCharToMultiByte called. This will make n
 is zero, and the second WideCharToMultiByte call will make the program
 crash.

 In MSDN shipped with Visual Studio .NET 2003 it is said that parameters
 lpDefaultChar and lpUsedDefaultChar must be NULL not only for CP_UTF7 and
 CP_UTF8, but also for all codepages mentioned in notes for dwFlags
 parameter:

     50220
     50221
     50222
     50225
     50227
     50229
     57002 through 57011
     65000 (UTF-7)
     42 (Symbol)

  It is still true as of Windows 8 & 10: if you try to call

 BOOL bVal = FALSE;

 WideCharToMultiByte(50220, 0, L"asdf", 4, NULL, 0, NULL, &bVal);

 You'll get 0 with GetLastError 87 (ERROR_INVALID_PARAMETER).

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11848>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC