fix QUtf8 codec to disallow codes in range [U+fdd0..U+fdef]
0xfdef-0xfdd0 is definitely 31 and not 15 :) also fix all copy-pastes of this code (greping for '0xfdd0' helps ;) Change-Id: I8f3bd4fd9d85f9de066f0f5df378b9188c12bd48 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>bb10
parent
7ff5fb610c
commit
9327bc87c3
|
|
@ -58,7 +58,7 @@ static inline bool isUnicodeNonCharacter(uint ucs4)
|
|||
// U+FDEF (inclusive)
|
||||
|
||||
return (ucs4 & 0xfffe) == 0xfffe
|
||||
|| (ucs4 - 0xfdd0U) < 16;
|
||||
|| (ucs4 - 0xfdd0U) < 32;
|
||||
}
|
||||
|
||||
QByteArray QUtf8::convertFromUnicode(const QChar *uc, int len, QTextCodec::ConverterState *state)
|
||||
|
|
|
|||
|
|
@ -731,7 +731,7 @@ static inline bool isUnicodeNonCharacter(uint ucs4)
|
|||
// U+FDEF (inclusive)
|
||||
|
||||
return (ucs4 & 0xfffe) == 0xfffe
|
||||
|| (ucs4 - 0xfdd0U) < 16;
|
||||
|| (ucs4 - 0xfdd0U) < 32;
|
||||
}
|
||||
|
||||
static inline bool scanUtf8Char(const char *&json, const char *end, uint *result)
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ static inline bool isUnicodeNonCharacter(uint ucs4)
|
|||
// U+FDEF (inclusive)
|
||||
|
||||
return (ucs4 & 0xfffe) == 0xfffe
|
||||
|| (ucs4 - 0xfdd0U) < 16;
|
||||
|| (ucs4 - 0xfdd0U) < 32;
|
||||
}
|
||||
|
||||
static inline uchar hexdig(uint u)
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ void tst_Utf8::nonCharacters_data()
|
|||
// U+FDEF (inclusive)
|
||||
|
||||
// U+FDD0 through U+FDEF
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
char utf8[] = { char(0357), char(0267), char(0220 + i), 0 };
|
||||
QString utf16 = QChar(0xfdd0 + i);
|
||||
QTest::newRow(qPrintable(QString::number(0xfdd0 + i, 16))) << QByteArray(utf8) << utf16;
|
||||
|
|
|
|||
|
|
@ -1944,7 +1944,7 @@ static inline bool isUnicodeNonCharacter(uint ucs4)
|
|||
// U+FDEF (inclusive)
|
||||
|
||||
return (ucs4 & 0xfffe) == 0xfffe
|
||||
|| (ucs4 - 0xfdd0U) < 16;
|
||||
|| (ucs4 - 0xfdd0U) < 32;
|
||||
}
|
||||
|
||||
int fromUtf8_qt47(ushort *dst, const char *chars, int len)
|
||||
|
|
|
|||
Loading…
Reference in New Issue