ART: Tighten verifier list reading and offsets
Check offsets and sizes for header entries of a dex file.
Bug: 17347459
(cherry picked from commit 78d639ef4be3ad7314846e1e6c1261d7d30f83fa)
Change-Id: Ia1727c33dea51f7a8e345f3799f1ba414708239c
diff --git a/runtime/dex_file_verifier.h b/runtime/dex_file_verifier.h
index 1d915b9..606da54 100644
--- a/runtime/dex_file_verifier.h
+++ b/runtime/dex_file_verifier.h
@@ -43,6 +43,12 @@
bool CheckShortyDescriptorMatch(char shorty_char, const char* descriptor, bool is_return_type);
bool CheckListSize(const void* start, size_t count, size_t element_size, const char* label);
+ // Check a list. The head is assumed to be at *ptr, and elements to be of size element_size. If
+ // successful, the ptr will be moved forward the amount covered by the list.
+ bool CheckList(size_t element_size, const char* label, const byte* *ptr);
+ // Checks whether the offset is zero (when size is zero) or that the offset falls within the area
+ // claimed by the file.
+ bool CheckValidOffsetAndSize(uint32_t offset, uint32_t size, const char* label);
bool CheckIndex(uint32_t field, uint32_t limit, const char* label);
bool CheckHeader();