diff options
author | Andreas Gampe <agampe@google.com> | 2017-02-26 14:10:28 -0800 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2017-02-26 14:12:02 -0800 |
commit | 0c95c12a102cb8c1514410be6e264f9730d847a7 (patch) | |
tree | 30c5f581ee7dd3186a9498f9fdc527aa0c31edc7 /compiler/optimizing/code_generator.cc | |
parent | 5e2227b961980c69361050a4396763937285af9b (diff) |
ART: Fix underflow in codegen
Check for count == 0 first before accessing non-existent stack map.
Test: m ART_TEST_JIT=true test-art-host
Test: m ART_TEST_JIT=true test-art-host-run-test-913-heaps
Change-Id: Id4cad8e791d731147860b8a9a0d90cc893cc6972
Diffstat (limited to 'compiler/optimizing/code_generator.cc')
-rw-r--r-- | compiler/optimizing/code_generator.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index 8dd423fcbb..424b8507fb 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -861,8 +861,11 @@ void CodeGenerator::RecordPcInfo(HInstruction* instruction, bool CodeGenerator::HasStackMapAtCurrentPc() { uint32_t pc = GetAssembler()->CodeSize(); size_t count = stack_map_stream_.GetNumberOfStackMaps(); + if (count == 0) { + return false; + } CodeOffset native_pc_offset = stack_map_stream_.GetStackMap(count - 1).native_pc_code_offset; - return (count > 0) && (native_pc_offset.Uint32Value(GetInstructionSet()) == pc); + return (native_pc_offset.Uint32Value(GetInstructionSet()) == pc); } void CodeGenerator::MaybeRecordNativeDebugInfo(HInstruction* instruction, |