Fix bug in QDateTimeParser::findTimeZoneName()'s length-limiting

The recent commit 0c9fc20e7f 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 <thiago.macieira@intel.com>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
This commit is contained in:
Edward Welbourne 2021-04-19 13:28:49 +02:00
parent 7cdf77f5e7
commit e41dbfd3a4

View File

@ -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