summaryrefslogtreecommitdiff
path: root/libartbase/base/bit_vector.cc
diff options
context:
space:
mode:
author Alex Light <allight@google.com> 2020-09-17 14:01:55 -0700
committer Alex Light <allight@google.com> 2020-09-18 21:43:11 +0000
commit46c2a23dbbe48c8ba1dd0238e844f9b5fda47ec7 (patch)
treed905233d37e6af9f4476b9d25b63baa7f8c4f5b3 /libartbase/base/bit_vector.cc
parentb76cb89736d889929939223a22bc7fb44c6117b2 (diff)
Don't assume allocators clear memory
BitVector, when constructed with an explicit size, would assume that the allocator would zero out memory. This is not always true and could lead to unexpected outcomes. Test: ./test.py --host Change-Id: Ibe556ebf07b5081f110e76efa927b7fa677a607e
Diffstat (limited to 'libartbase/base/bit_vector.cc')
-rw-r--r--libartbase/base/bit_vector.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/libartbase/base/bit_vector.cc b/libartbase/base/bit_vector.cc
index 2ef14d7074..b32b4117dd 100644
--- a/libartbase/base/bit_vector.cc
+++ b/libartbase/base/bit_vector.cc
@@ -45,9 +45,10 @@ BitVector::BitVector(uint32_t start_bits,
allocator,
BitsToWords(start_bits),
static_cast<uint32_t*>(allocator->Alloc(BitsToWords(start_bits) * kWordBytes))) {
+ // We don't know if the allocator cleared things.
+ ClearAllBits();
}
-
BitVector::BitVector(const BitVector& src,
bool expandable,
Allocator* allocator)