diff options
Diffstat (limited to 'runtime/stack_map.h')
| -rw-r--r-- | runtime/stack_map.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/runtime/stack_map.h b/runtime/stack_map.h index dd7e53100f..5e556be286 100644 --- a/runtime/stack_map.h +++ b/runtime/stack_map.h @@ -1093,7 +1093,9 @@ class CodeInfo { } CodeInfoEncoding ExtractEncoding() const { - return CodeInfoEncoding(region_.start()); + CodeInfoEncoding encoding(region_.start()); + AssertValidStackMap(encoding); + return encoding; } bool HasInlineInfo(const CodeInfoEncoding& encoding) const { @@ -1254,6 +1256,18 @@ class CodeInfo { uint16_t number_of_dex_registers, bool dump_stack_maps) const; + // Check that the code info has valid stack map and abort if it does not. + void AssertValidStackMap(const CodeInfoEncoding& encoding) const { + if (region_.size() != 0 && region_.size() < GetStackMapsSize(encoding)) { + LOG(FATAL) << region_.size() << "\n" + << encoding.header_size << "\n" + << encoding.non_header_size << "\n" + << encoding.number_of_location_catalog_entries << "\n" + << encoding.number_of_stack_maps << "\n" + << encoding.stack_map_size_in_bytes; + } + } + private: MemoryRegion GetStackMaps(const CodeInfoEncoding& encoding) const { return region_.size() == 0 |