From cc5e84c8788a6d6f05dfdf76fc249177ee74dce1 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 11 Aug 2015 09:59:10 -0700 Subject: 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 --- tests/auto/corelib/tools/qtime/tst_qtime.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/auto/corelib/tools/qtime') 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() -- cgit v1.2.3