diff options
author | nyamatongwe <devnull@localhost> | 2010-06-24 06:46:03 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2010-06-24 06:46:03 +0000 |
commit | e567a0d1f146f412a14709e84420334f7febfbcd (patch) | |
tree | b4f99d040abf1ce8b28a3abe2fcbb734a9a5022b | |
parent | bff4ea7d646d326091e6fd8c2eb86abcff439b0c (diff) | |
download | scintilla-mirror-e567a0d1f146f412a14709e84420334f7febfbcd.tar.gz |
Protect against bad UTF-8 when case folding.
-rw-r--r-- | win32/ScintillaWin.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index ce959f893..31a7a0ab5 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -1314,6 +1314,12 @@ public: size_t nUtf16Mixed = ::MultiByteToWideChar(65001, 0, mixed, lenMixed, &utf16Mixed[0], utf16Mixed.size()); + if (nUtf16Mixed == 0) { + // Failed to convert -> bad UTF-8 + folded[0] = '\0'; + return 1; + } + if (nUtf16Mixed * 4 > utf16Folded.size()) { // Maximum folding expansion factor of 4 utf16Folded.resize(nUtf16Mixed * 4 + 8); } |