Accept 0xFFFFFFFF as dex debug info offset.
Bug: 22023362
Change-Id: I03e5c74f5ece4dbe1fab37d8b5f857582b04f57c
diff --git a/runtime/dex_file.h b/runtime/dex_file.h
index 7ac264a..3a15f1a 100644
--- a/runtime/dex_file.h
+++ b/runtime/dex_file.h
@@ -786,7 +786,10 @@
// 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_;