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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 17611 matching lines...) Expand 10 before | Expand all | Expand 10 after
17622 Bigint::InstanceSize(), 17622 Bigint::InstanceSize(),
17623 space); 17623 space);
17624 NoSafepointScope no_safepoint; 17624 NoSafepointScope no_safepoint;
17625 result ^= raw; 17625 result ^= raw;
17626 } 17626 }
17627 // Clamp the digits array. 17627 // Clamp the digits array.
17628 while ((used > 0) && (digits.GetUint32((used - 1) << 2) == 0)) { 17628 while ((used > 0) && (digits.GetUint32((used - 1) << 2) == 0)) {
17629 --used; 17629 --used;
17630 } 17630 }
17631 if (used > 0) { 17631 if (used > 0) {
17632 if ((used & 1) != 0) { 17632 if (((used & 1) != 0) && (digits.GetUint32(used << 2) != 0)) {
17633 // Set leading zero for 64-bit processing of digit pairs. 17633 // Set leading zero for 64-bit processing of digit pairs if not set.
17634 // The check above ensures that we avoid a write access to a possibly
17635 // reused digits array that could be marked read only.
17634 digits.SetUint32(used << 2, 0); 17636 digits.SetUint32(used << 2, 0);
17635 } 17637 }
17636 result.set_digits(digits); 17638 result.set_digits(digits);
17637 } else { 17639 } else {
17638 neg = false; 17640 neg = false;
17639 result.set_digits( 17641 result.set_digits(
17640 TypedData::Handle(zone, TypedData::EmptyUint32Array(thread))); 17642 TypedData::Handle(zone, TypedData::EmptyUint32Array(thread)));
17641 } 17643 }
17642 result.SetNeg(neg); 17644 result.SetNeg(neg);
17643 result.SetUsed(used); 17645 result.SetUsed(used);
(...skipping 3762 matching lines...) Expand 10 before | Expand all | Expand 10 after
21406 return UserTag::null(); 21408 return UserTag::null();
21407 } 21409 }
21408 21410
21409 21411
21410 const char* UserTag::ToCString() const { 21412 const char* UserTag::ToCString() const {
21411 const String& tag_label = String::Handle(label()); 21413 const String& tag_label = String::Handle(label());
21412 return tag_label.ToCString(); 21414 return tag_label.ToCString();
21413 } 21415 }
21414 21416
21415 } // namespace dart 21417 } // namespace dart
OLDNEW
« 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