summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-04-19 13:30:19 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2021-04-20 21:33:00 +0200
commitec8808c3020abbc436f1a2d90fecf3245fd6417b (patch)
tree199c0cc05515e8c05ceb29247b862f348731a702 /tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
parente41dbfd3a46b9415d24a3b4cfa0fd9110f6001ea (diff)
Return early from QTimeZone constructor if alleged IANA ID is invalid
If the ID isn't even valid, don't waste cycles trying to make sense of it as identifying a time-zone. Add test of an invalid ID that provoked an integer overflow on trying to parse it as a POSIX zone specification. Fixes: QTBUG-92842 Change-Id: Ib80bbb88c11c0484ce0358acabbdc25c5bd8e0b3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp')
-rw-r--r--tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
index 9c505e5baa..13300cee68 100644
--- a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
@@ -1000,6 +1000,9 @@ void tst_QTimeZone::malformed()
barf = QTimeZone("QtC+09,,MA");
if (barf.isValid())
QCOMPARE(barf.offsetFromUtc(now), 0);
+ barf = QTimeZone("UTCC+14:00,-,");
+ if (barf.isValid())
+ QCOMPARE(barf.daylightTimeOffset(now), -14 * 3600);
}
void tst_QTimeZone::utcTest()