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

Unified Diff: runtime/vm/object.cc

Issue 1685353003: Fix crash in Bigint::New(....), read only digits field was being modified resulting in a crash. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address-code-review Created 4 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index cbe16025761d7a41c0224e8358fd7f917f66653a..100ddb3fa53c14f613dfddc341d5254cbc8cef9e 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -17629,8 +17629,10 @@ RawBigint* Bigint::New(bool neg, intptr_t used, const TypedData& digits,
--used;
}
if (used > 0) {
- if ((used & 1) != 0) {
- // Set leading zero for 64-bit processing of digit pairs.
+ if (((used & 1) != 0) && (digits.GetUint32(used << 2) != 0)) {
+ // Set leading zero for 64-bit processing of digit pairs if not set.
+ // The check above ensures that we avoid a write access to a possibly
+ // reused digits array that could be marked read only.
digits.SetUint32(used << 2, 0);
}
result.set_digits(digits);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698