zeroing BitMemoryRegion buffer.
WriteMethods use ForMethodBitmapHotnessFlags to store bit, But it may
not store bit on some conditions.
For scudo in Android S zeroing heap is by default. so it works normally.
But if MALLOC_ZERO_CONTENTS is false or using jemalloc allocator,
the heap may filled with dirty data. so we should zero BitmayRegion
buffer.
Test: malloc_svelte target
run cts -m CtsDexMetadataHostTestCases -t
com.android.cts.dexmetadata.InstallDexMetadataHostTest#testProfileSnapshotAfterInstall
Bug: 201627008
Change-Id: I92aa4dffd6bb5ba51f515c9bea4837f2d4cbf706
Signed-off-by: liuhailong <liuhailong@oppo.com>
Signed-off-by: xieliujie <xieliujie@oppo.com>
diff --git a/libprofile/profile/profile_compilation_info.cc b/libprofile/profile/profile_compilation_info.cc
index da54bc6..8fbd1d1 100644
--- a/libprofile/profile/profile_compilation_info.cc
+++ b/libprofile/profile/profile_compilation_info.cc
@@ -414,7 +414,7 @@
ptr_end_(nullptr) {}
explicit SafeBuffer(size_t size)
- : storage_(new uint8_t[size]),
+ : storage_(new uint8_t[size]()),
ptr_current_(storage_.get()),
ptr_end_(ptr_current_ + size) {}