OSDN Git Service

Accept 0xFFFFFFFF as dex debug info offset.
authorDavid Srbecky <dsrbecky@google.com>
Tue, 7 Jul 2015 18:13:29 +0000 (19:13 +0100)
committerDavid Srbecky <dsrbecky@google.com>
Tue, 7 Jul 2015 18:57:55 +0000 (19:57 +0100)
Bug: 22023362
Change-Id: I03e5c74f5ece4dbe1fab37d8b5f857582b04f57c

runtime/dex_file.h

index 7ac264a..3a15f1a 100644 (file)
@@ -786,7 +786,10 @@ class DexFile {
 
   // Get the pointer to the start of the debugging data
   const uint8_t* GetDebugInfoStream(const CodeItem* code_item) const {
-    if (code_item->debug_info_off_ == 0) {
+    // Check that the offset is in bounds.
+    // Note that although the specification says that 0 should be used if there
+    // is no debug information, some applications incorrectly use 0xFFFFFFFF.
+    if (code_item->debug_info_off_ == 0 || code_item->debug_info_off_ >= size_) {
       return nullptr;
     } else {
       return begin_ + code_item->debug_info_off_;