diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2012-04-11 17:33:22 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-11 19:14:43 +0200 |
commit | 9327bc87c3abf58bb471693b5448cd78e3db1b46 (patch) | |
tree | cecb28ed7d9b8652025b8a992d4296d9e3a1c293 | |
parent | 7ff5fb610c665d8aa5eb5be431e96540caeb75ef (diff) |
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>
-rw-r--r-- | src/corelib/codecs/qutfcodec.cpp | 2 | ||||
-rw-r--r-- | src/corelib/json/qjsonparser.cpp | 2 | ||||
-rw-r--r-- | src/corelib/json/qjsonwriter.cpp | 2 | ||||
-rw-r--r-- | tests/auto/corelib/codecs/utf8/tst_utf8.cpp | 2 | ||||
-rw-r--r-- | tests/benchmarks/corelib/tools/qstring/main.cpp | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp index c7076eea3a..18d063a38c 100644 --- a/src/corelib/codecs/qutfcodec.cpp +++ b/src/corelib/codecs/qutfcodec.cpp @@ -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) diff --git a/src/corelib/json/qjsonparser.cpp b/src/corelib/json/qjsonparser.cpp index 9b11c9ac3e..7d25c81db2 100644 --- a/src/corelib/json/qjsonparser.cpp +++ b/src/corelib/json/qjsonparser.cpp @@ -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) diff --git a/src/corelib/json/qjsonwriter.cpp b/src/corelib/json/qjsonwriter.cpp index d544e6154b..d392bd7529 100644 --- a/src/corelib/json/qjsonwriter.cpp +++ b/src/corelib/json/qjsonwriter.cpp @@ -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) diff --git a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp index b80ba8e665..c0ed152c32 100644 --- a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp +++ b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp @@ -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; diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/tools/qstring/main.cpp index 9b10e97f2b..40300af947 100644 --- a/tests/benchmarks/corelib/tools/qstring/main.cpp +++ b/tests/benchmarks/corelib/tools/qstring/main.cpp @@ -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) |