From e41dbfd3a46b9415d24a3b4cfa0fd9110f6001ea Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 19 Apr 2021 13:28:49 +0200 Subject: [PATCH] Fix bug in QDateTimeParser::findTimeZoneName()'s length-limiting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The recent commit 0c9fc20e7ff7b4ff0f15e0b2c071ea834625dce9 missed the case of a slash after some invalid character. That could lead it to reinclude the invalid after previously working out it should ignore it. Change-Id: I3e29d2bf4d8df3878b581a969348ff5087b5d847 Reviewed-by: Thiago Macieira Reviewed-by: Robert Löhning --- src/corelib/time/qdatetimeparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp index 2a16adedbf8..2e279217173 100644 --- a/src/corelib/time/qdatetimeparser.cpp +++ b/src/corelib/time/qdatetimeparser.cpp @@ -1748,7 +1748,7 @@ QDateTimeParser::findTimeZoneName(QStringView str, const QDateTime &when) const Q_ASSERT(index <= str.size()); while (lastSlash < index) { int slash = str.indexOf(QLatin1Char('/'), lastSlash + 1); - if (slash < 0) + if (slash < 0 || slash > index) slash = index; // i.e. the end of the candidate text else if (++count > 5) index = slash; // Truncate