diff options
| author | 2017-01-05 10:17:55 -0800 | |
|---|---|---|
| committer | 2017-01-05 14:08:18 -0800 | |
| commit | 01c78147d3e2f6eedba8b13dbfc46dc4ed61cb5d (patch) | |
| tree | be1050f692a7fccdbbcfc86dc28749fdb82e2bf2 | |
| parent | 001cd47ddd81e5bdd6cc2051beced4799124315a (diff) | |
Add some code info checking in GetCalleeSaveMethodCaller
Will print info if the memory region is too small for the stack maps.
Test: test-art-host
Bug: 33924573
Change-Id: I03e0151724d3a0933f3bef004e0d16ba1c6134c4
| -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 |