summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author David Brazdil <dbrazdil@google.com> 2018-11-12 10:46:14 +0000
committer David Brazdil <dbrazdil@google.com> 2018-11-12 10:49:29 +0000
commit976b01f62ad8fa2e4a25f64c152839eb37552f9e (patch)
tree5b6206e8a069f5b824e7c96582188f1601a4afa0
parentfe59955fc41e277bf1c60378202ba785abb1e4a8 (diff)
hiddenapi: Initialize unused value in DexFile::MapItem
The build tool adds a new MapItem into the MapList of a dex file which points to the new hiddenapi flags section. However, hiddenapi would not initialize the `unused_` field in MapItem and therefore result in non-deterministic builds. Bug: 119308882 Test: invoke hiddenapi twice of the same dex, diff the two files Change-Id: I00d0dc909a3424f3eb2776cf87719c074f264e74
-rw-r--r--tools/hiddenapi/hiddenapi.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/hiddenapi/hiddenapi.cc b/tools/hiddenapi/hiddenapi.cc
index f61b3e8038..65a4945355 100644
--- a/tools/hiddenapi/hiddenapi.cc
+++ b/tools/hiddenapi/hiddenapi.cc
@@ -813,6 +813,7 @@ class DexFileEditor final {
// Create a new MapItem entry with new MapList details.
DexFile::MapItem new_item;
new_item.type_ = old_item.type_;
+ new_item.unused_ = 0u; // initialize to ensure dex output is deterministic (b/119308882)
new_item.size_ = old_item.size_;
new_item.offset_ = new_map_offset;