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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 2982753002: Fix bug in Dart API Dart_IntegerToUint64: crash on negative Mints (Closed)
Patch Set: Created 3 years, 5 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 | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 05f84cdee3ba731a2f9173bff18a4199060b097b..b9501b9421815afedcbf485482c055da6bfc8838 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -2141,9 +2141,11 @@ DART_EXPORT Dart_Handle Dart_IntegerToUint64(Dart_Handle integer,
}
if (int_obj.IsSmi()) {
ASSERT(int_obj.IsNegative());
- } else if (int_obj.IsMint() && !int_obj.IsNegative()) {
- *value = int_obj.AsInt64Value();
- return Api::Success();
+ } else if (int_obj.IsMint()) {
+ if (!int_obj.IsNegative()) {
+ *value = int_obj.AsInt64Value();
+ return Api::Success();
+ }
} else {
const Bigint& bigint = Bigint::Cast(int_obj);
if (bigint.FitsIntoUint64()) {
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698