Fix out-of-bounds assert in winIso639LangName()
QByteArray doesn't allow accessing, with operator[], the '\0' byte it
stores at index size(). Previously we accessed it indirectly by
dereferencing a pointer offset from its data() instead of indexing; my
recent change converted the return of an endptr to the return of its
index, so used operator[].
This is a follow-up to commit 6c435e5dd4
Change-Id: I9faf9dfa3dcc8df1e841e5538e452afef9ba610c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
bb10
parent
ef379f95c7
commit
e36457c043
|
|
@ -1076,7 +1076,7 @@ static QString winIso639LangName(LCID id)
|
|||
if (!lang_code.isEmpty()) {
|
||||
const QByteArray latin1 = std::move(lang_code).toLatin1();
|
||||
const auto [i, used] = qstrntoull(latin1.data(), latin1.size(), 16);
|
||||
if (used > 0 && latin1[used] == '\0') {
|
||||
if (used >= latin1.size() || (used > 0 && latin1[used] == '\0')) {
|
||||
switch (i) {
|
||||
case 0x814:
|
||||
result = u"nn"_s; // Nynorsk
|
||||
|
|
|
|||
Loading…
Reference in New Issue