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>
This commit is contained in:
Giuseppe D'Angelo 2020-11-04 15:01:30 +01:00
parent d0a4084cbf
commit dcbc8f16d0

View File

@ -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;