From 6852942773fde6ac40cec204f5ad63daacd3c74d Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Tue, 7 Jul 2015 19:13:29 +0100 Subject: [PATCH] Accept 0xFFFFFFFF as dex debug info offset. Bug: 22023362 Change-Id: I03e5c74f5ece4dbe1fab37d8b5f857582b04f57c --- runtime/dex_file.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/dex_file.h b/runtime/dex_file.h index 7ac264a0c..3a15f1ac7 100644 --- a/runtime/dex_file.h +++ b/runtime/dex_file.h @@ -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_; -- 2.11.0