OSDN Git Service

ART: Better error reporting on broken oat file
authorAndreas Gampe <agampe@google.com>
Tue, 9 Sep 2014 06:39:45 +0000 (23:39 -0700)
committerAndreas Gampe <agampe@google.com>
Tue, 9 Sep 2014 06:39:45 +0000 (23:39 -0700)
Do not blow up when in GetHashBucket if GetHashBucketNum is zero.
Instead back-step to ElfFileOpen, which prints which symbol was
missing from which file.

Bug: 17422404
Change-Id: I3b890dd1c31c08b1ccc0f7f668afcceee95f8d00

runtime/elf_file.cc

index 6179b5e..f6e8921 100644 (file)
@@ -584,6 +584,10 @@ const byte* ElfFile::FindDynamicSymbolAddress(const std::string& symbol_name) co
 }
 
 const Elf32_Sym* ElfFile::FindDynamicSymbol(const std::string& symbol_name) const {
+  if (GetHashBucketNum() == 0) {
+    // No dynamic symbols at all.
+    return nullptr;
+  }
   Elf32_Word hash = elfhash(symbol_name.c_str());
   Elf32_Word bucket_index = hash % GetHashBucketNum();
   Elf32_Word symbol_and_chain_index = GetHashBucket(bucket_index);