Don't read beyond the end of input buffer when decoding UTF-16.
wxMBConvStrictUTF8::FromWChar() didn't update the input length correctly when encountering a surrogate while decoding UTF-16 and could read beyond the end of the input buffer in this case. Fix this by simply adjusting the input length when a surrogate is read. Closes #13614. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69676 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
64b91e2d40
commit
041e6050fd
@ -1145,6 +1145,8 @@ wxMBConvStrictUTF8::FromWChar(char *dst, size_t dstLen,
|
||||
{
|
||||
// skip the next char too as we decoded a surrogate
|
||||
wp++;
|
||||
if ( srcLen != wxNO_LEN )
|
||||
srcLen--;
|
||||
}
|
||||
#else // wchar_t is UTF-32
|
||||
code = *wp & 0x7fffffff;
|
||||
|
Loading…
Reference in New Issue
Block a user