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

Unified Diff: runtime/lib/date.cc

Issue 1845483002: Fix core lib DateTime in the VM. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: adress comments Created 4 years, 9 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 | « CHANGELOG.md ('k') | runtime/lib/date_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/date.cc
diff --git a/runtime/lib/date.cc b/runtime/lib/date.cc
index cf92809836bac21d94b09a1861a2534585972dd0..ba9fa95d9117f86178e13ec5bcbba5fedac3152c 100644
--- a/runtime/lib/date.cc
+++ b/runtime/lib/date.cc
@@ -12,13 +12,13 @@
namespace dart {
-static int32_t kMaxAllowedSeconds = 2100000000;
+static int64_t kMaxAllowedSeconds = kMaxInt32;
DEFINE_NATIVE_ENTRY(DateTime_timeZoneName, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(
Integer, dart_seconds, arguments->NativeArgAt(0));
int64_t seconds = dart_seconds.AsInt64Value();
- if (seconds < 0 || seconds > kMaxAllowedSeconds) {
+ if (llabs(seconds) > kMaxAllowedSeconds) {
Exceptions::ThrowArgumentError(dart_seconds);
}
const char* name = OS::GetTimeZoneName(seconds);
@@ -30,7 +30,7 @@ DEFINE_NATIVE_ENTRY(DateTime_timeZoneOffsetInSeconds, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(
Integer, dart_seconds, arguments->NativeArgAt(0));
int64_t seconds = dart_seconds.AsInt64Value();
- if (seconds < 0 || seconds > kMaxAllowedSeconds) {
+ if (llabs(seconds) > kMaxAllowedSeconds) {
Exceptions::ThrowArgumentError(dart_seconds);
}
int offset = OS::GetTimeZoneOffsetInSeconds(seconds);
« no previous file with comments | « CHANGELOG.md ('k') | runtime/lib/date_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698