diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2015-08-11 09:59:10 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-08-19 22:13:40 +0000 |
commit | cc5e84c8788a6d6f05dfdf76fc249177ee74dce1 (patch) | |
tree | 7463db9855881cdea212bdaf3879dca5a536c64c /tests/auto/corelib/tools/qtime | |
parent | cc6a06632b26c4f60cb29f540af6eafc31ae3f02 (diff) |
Avoid overflow in QTime::addSecs with too big a number of seconds
QDateTime::addSecs needs to do something similar, but not identical
because it needs the number of days too. And then there are daylight
savings transitions...
Task-number: QTBUG-47717
Change-Id: I7de033f80b0e4431b7f1ffff13f976f4f5e5a059
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'tests/auto/corelib/tools/qtime')
-rw-r--r-- | tests/auto/corelib/tools/qtime/tst_qtime.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qtime/tst_qtime.cpp b/tests/auto/corelib/tools/qtime/tst_qtime.cpp index 9a9101b7e9..213b817c3d 100644 --- a/tests/auto/corelib/tools/qtime/tst_qtime.cpp +++ b/tests/auto/corelib/tools/qtime/tst_qtime.cpp @@ -84,6 +84,8 @@ void tst_QTime::addSecs_data() QTest::newRow("Data0") << QTime(0,0,0) << 200 << QTime(0,3,20); QTest::newRow("Data1") << QTime(0,0,0) << 20 << QTime(0,0,20); + QTest::newRow("overflow") << QTime(0,0,0) << (INT_MAX / 1000 + 1) + << QTime(0,0,0).addSecs((INT_MAX / 1000 + 1) % 86400); } void tst_QTime::addSecs() |