summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2013-11-22 15:03:14 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-06 01:36:09 +0100
commit689152e7c1c6b0e851937a20de96c99aa7a7ea2b (patch)
treee2071e45c294ae830eef6e1f63dbebe4161d5419 /src/corelib
parentb9c8073230dfd90962188a24f78d4f4157f9eaad (diff)
QTimeZone: Fix isValidId()
Fix isValidId() which was failing valid IDs because it was splitting name parts by \ instead of /. it was also rejecting offset from UTC formats names. Add unit tests. Task-number: QTBUG-35025 Change-Id: I4d23d2e54f4a9fac9afcc4eff0a02d6f4af21385 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qtimezoneprivate.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp
index ee34469c03..dffb20b7cf 100644
--- a/src/corelib/tools/qtimezoneprivate.cpp
+++ b/src/corelib/tools/qtimezoneprivate.cpp
@@ -453,9 +453,9 @@ bool QTimeZonePrivate::isValidId(const QByteArray &olsenId)
// Aliases such as "Etc/GMT+7" and "SystemV/EST5EDT" are valid so we need to accept digits
if (olsenId.contains(' '))
return false;
- QList<QByteArray> parts = olsenId.split('\\');
+ QList<QByteArray> parts = olsenId.split('/');
foreach (const QByteArray &part, parts) {
- if (part.size() > 14)
+ if (part.size() > 14 || part.size() < 1)
return false;
if (part.at(0) == '-')
return false;
@@ -466,6 +466,8 @@ bool QTimeZonePrivate::isValidId(const QByteArray &olsenId)
&& !(ch == '_')
&& !(ch >= '0' && ch <= '9')
&& !(ch == '-')
+ && !(ch == '+')
+ && !(ch == ':')
&& !(ch == '.'))
return false;
}