[Box Backup-dev] COMMIT r269 - box/chris/win32/vc2005-compile-fixes/lib/backupclient
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Thu, 22 Dec 2005 02:10:58 +0000 (GMT)
Author: chris
Date: 2005-12-22 02:10:57 +0000 (Thu, 22 Dec 2005)
New Revision: 269
Modified:
box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupClientFileAttributes.cpp
Log:
Avoid aborting on win32 when large invalid times are present in the store
Modified: box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupClientFileAttributes.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupClientFileAttributes.cpp 2005-12-22 02:09:50 UTC (rev 268)
+++ box/chris/win32/vc2005-compile-fixes/lib/backupclient/BackupClientFileAttributes.cpp 2005-12-22 02:10:57 UTC (rev 269)
@@ -335,7 +335,13 @@
box_time_t bob = BoxTimeToSeconds(pattr->ModificationTime);
__time64_t winTime = bob;
- if (_gmtime64(&winTime) == 0 )
+
+ // _MAX__TIME64_T doesn't seem to be defined, but the code below
+ // will throw an assertion failure if we exceed it :-)
+ // Microsoft says dates up to the year 3000 are valid, which
+ // is a bit more than 15 * 2^32. Even that doesn't seem
+ // to be true (still aborts), but it can at least hold 2^32.
+ if (winTime >= 0x100000000 || _gmtime64(&winTime) == 0)
{
::syslog(LOG_ERR, "Corrupt value in store "
"Modification Time in file %s", Filename);
@@ -344,7 +350,7 @@
bob = BoxTimeToSeconds(pattr->AttrModificationTime);
winTime = bob;
- if (_gmtime64(&winTime) == 0 )
+ if (winTime > 0x100000000 || _gmtime64(&winTime) == 0)
{
::syslog(LOG_ERR, "Corrupt value in store "
"Attr Modification Time in file %s", Filename);