We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 435d69c commit b2aadf6Copy full SHA for b2aadf6
Release/src/utilities/asyncrt_utils.cpp
@@ -377,12 +377,13 @@ std::string __cdecl conversions::utf16_to_utf8(const utf16string &w)
377
// Check for high surrogate.
378
if (src >= H_SURROGATE_START && src <= H_SURROGATE_END)
379
{
380
- const auto highSurrogate = w[++index];
+ const auto highSurrogate = src;
381
+ ++index;
382
if (index == w.size())
383
384
throw std::range_error("UTF-16 string is missing low surrogate");
385
}
- const auto lowSurrogate = src;
386
+ const auto lowSurrogate = w[index];
387
if (lowSurrogate < L_SURROGATE_START || lowSurrogate > L_SURROGATE_END)
388
389
throw std::range_error("UTF-16 string has invalid low surrogate");
0 commit comments