From 31e94dc96cf372db27d9a064e770180178f70156 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 23 Nov 2019 01:54:38 +0100 Subject: [PATCH] QGb18030Codec: fix out-of-bounds access when decoding surrogate pairs This is already the second surrogate of the pair, there's no need to + +i. Fixes: QTBUG-80268 Change-Id: Ia2aa807ffa8a4c798425fffd15d9a48ee0ca8ed7 Reviewed-by: Lars Knoll --- src/corelib/codecs/qgb18030codec.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/corelib/codecs/qgb18030codec.cpp b/src/corelib/codecs/qgb18030codec.cpp index 4206eacb6f..ca15be1cea 100644 --- a/src/corelib/codecs/qgb18030codec.cpp +++ b/src/corelib/codecs/qgb18030codec.cpp @@ -107,7 +107,6 @@ QByteArray QGb18030Codec::convertFromUnicode(const QChar *uc, int len, Converter if (high >= 0) { if (uc[i].isLowSurrogate()) { // valid surrogate pair - ++i; uint u = QChar::surrogateToUcs4(high, uc[i].unicode()); len = qt_UnicodeToGb18030(u, buf); if (len >= 2) {