From b8a0d8b7fc4735ce20107a4f4a6a09dbcb2a6198 Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Mon, 6 Mar 2023 15:54:38 +0000 Subject: Add DexFileContainer for all DexFiles. Ensure that all DexFiles have a container for consistency. Enforce that the container shall contain exactly one dex file, as specified the by file_size entry in the de header (that is, the memory range should not be truncated or too big). Bug: 266950186 Test: test.py -b --host --optimizing --64 Change-Id: I73ff074a980f9a9d5a0f4a9b51ac1a496971374f --- compiler/optimizing/optimizing_unit_test.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'compiler/optimizing/optimizing_unit_test.h') diff --git a/compiler/optimizing/optimizing_unit_test.h b/compiler/optimizing/optimizing_unit_test.h index 98ba38a59a..d0df4b89e5 100644 --- a/compiler/optimizing/optimizing_unit_test.h +++ b/compiler/optimizing/optimizing_unit_test.h @@ -241,13 +241,14 @@ class OptimizingUnitTestHelper { // Create the dex file based on the fake data. Call the constructor so that we can use virtual // functions. Don't use the arena for the StandardDexFile otherwise the dex location leaks. - dex_files_.emplace_back(new StandardDexFile( - dex_data, - sizeof(StandardDexFile::Header), - "no_location", - /*location_checksum*/ 0, - /*oat_dex_file*/ nullptr, - /*container*/ nullptr)); + auto container = + std::make_shared(dex_data, sizeof(StandardDexFile::Header)); + dex_files_.emplace_back(new StandardDexFile(dex_data, + sizeof(StandardDexFile::Header), + "no_location", + /*location_checksum*/ 0, + /*oat_dex_file*/ nullptr, + std::move(container))); graph_ = new (allocator) HGraph( allocator, -- cgit v1.2.3-59-g8ed1b