Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Unified Diff: ash/system/date/date_view.cc

Issue 10907178: Try to fix the possible bug in base::Time:Now() that can cause the crashing later in icu code calle… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/time_posix.cc » ('j') | base/time_posix.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/date/date_view.cc
diff --git a/ash/system/date/date_view.cc b/ash/system/date/date_view.cc
index 0ba186335bc698f30b8f527b1492dab41fb8e15d..c0849f7bf7a1d3ff65f48c51229969e8d939dd10 100644
--- a/ash/system/date/date_view.cc
+++ b/ash/system/date/date_view.cc
@@ -181,6 +181,14 @@ void TimeView::UpdateTimeFormat() {
}
void TimeView::UpdateTextInternal(const base::Time& now) {
+ // Just in case |now| is invalid, do NOT update time; otherwise, it will
+ // crash icu code by calling into base::TimeFormatTimeOfDayWithHourClockType,
+ // see details in crbug.com/147570.
+ if (now.ToInternalValue() == 0L) {
brettw 2012/09/11 18:10:23 Use now.is_null().
jennyz 2012/09/11 18:35:22 Done.
+ LOG(ERROR) << "Received invalid base::Time now value in the argument";
+ return;
+ }
+
string16 current_time = base::TimeFormatTimeOfDayWithHourClockType(
now, hour_type_, base::kDropAmPm);
label_->SetText(current_time);
« no previous file with comments | « no previous file | base/time_posix.cc » ('j') | base/time_posix.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698