diff options
author | jennyz@chromium.org <jennyz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-11 21:56:38 +0000 |
---|---|---|
committer | jennyz@chromium.org <jennyz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-11 21:56:38 +0000 |
commit | 0ea8334be610a505b3bd502d3c8f1b511a8fccff (patch) | |
tree | 2b06f2239963666c5fa80a94da28cfad1fd7e11a /base | |
parent | ba1c6ca05c542f4149d2fadbecd5f4a8ab2db236 (diff) | |
download | chromium_src-0ea8334be610a505b3bd502d3c8f1b511a8fccff.zip chromium_src-0ea8334be610a505b3bd502d3c8f1b511a8fccff.tar.gz chromium_src-0ea8334be610a505b3bd502d3c8f1b511a8fccff.tar.bz2 |
Try to fix the possible bug in base::Time:Now() that can cause the crashing later in icu code called from ash tray TimeView::UpdateTextInternal() if the call to gettimeofday fails.
BUG=147570
Review URL: https://chromiumcodereview.appspot.com/10907178
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156134 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/time_posix.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/base/time_posix.cc b/base/time_posix.cc index c79781c..e172ec1 100644 --- a/base/time_posix.cc +++ b/base/time_posix.cc @@ -70,6 +70,10 @@ Time Time::Now() { struct timezone tz = { 0, 0 }; // UTC if (gettimeofday(&tv, &tz) != 0) { DCHECK(0) << "Could not determine time of day"; + LOG_ERRNO(ERROR) << "Call to gettimeofday failed."; + // Return null instead of uninitialized |tv| value, which contains random + // garbage data. This may result in the crash seen in crbug.com/147570. + return Time(); } // Combine seconds and microseconds in a 64-bit field containing microseconds // since the epoch. That's enough for nearly 600 centuries. Adjust from |