diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-11-04 15:01:30 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-11-08 03:13:31 +0100 |
commit | dcbc8f16d0c1b6e394a1f6900310065c38895a4c (patch) | |
tree | 14b1e3a2a8eb80e545a4ee0073b3fc7b216f6ebd /src/corelib/text/qstringconverter.cpp | |
parent | d0a4084cbfb35da325bcc42f033fd37b3a415b89 (diff) |
Be explicit in a uint->QChar conversion
And check that the result fits.
Change-Id: Iaee1085315559bdffea9400b94b29869621ab7ff
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qstringconverter.cpp')
-rw-r--r-- | src/corelib/text/qstringconverter.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/text/qstringconverter.cpp b/src/corelib/text/qstringconverter.cpp index e66f512ed8..a0015c2c83 100644 --- a/src/corelib/text/qstringconverter.cpp +++ b/src/corelib/text/qstringconverter.cpp @@ -1063,7 +1063,9 @@ char *QUtf32::convertFromUnicode(char *out, QStringView in, QStringConverter::St QChar ch; uint ucs4; if (state->remainingChars == 1) { - ch = state->state_data[Data]; + auto character = state->state_data[Data]; + Q_ASSERT(character <= 0xFFFF); + ch = QChar(character); // this is ugly, but shortcuts a whole lot of logic that would otherwise be required state->remainingChars = 0; goto decode_surrogate; |