| 172 | } |
| 173 | |
| 174 | void DexFile::InitializeSectionsFromMapList() { |
| 175 | const MapList* map_list = reinterpret_cast<const MapList*>(DataBegin() + header_->map_off_); |
| 176 | if (header_->map_off_ == 0 || header_->map_off_ > DataSize()) { |
| 177 | // Bad offset. The dex file verifier runs after this method and will reject the file. |
| 178 | return; |
| 179 | } |
| 180 | const size_t count = map_list->size_; |
| 181 | |
| 182 | size_t map_limit = header_->map_off_ + count * sizeof(MapItem); |
| 183 | if (header_->map_off_ >= map_limit || map_limit > DataSize()) { |
| 184 | // Overflow or out out of bounds. The dex file verifier runs after |
| 185 | // this method and will reject the file as it is malformed. |
| 186 | return; |
| 187 | } |
| 188 | |
| 189 | for (size_t i = 0; i < count; ++i) { |
| 190 | const MapItem& map_item = map_list->list_[i]; |
| 191 | if (map_item.type_ == kDexTypeMethodHandleItem) { |
| 192 | method_handles_ = reinterpret_cast<const MethodHandleItem*>(Begin() + map_item.offset_); |
| 193 | num_method_handles_ = map_item.size_; |
| 194 | } else if (map_item.type_ == kDexTypeCallSiteIdItem) { |
| 195 | call_site_ids_ = reinterpret_cast<const CallSiteIdItem*>(Begin() + map_item.offset_); |
| 196 | num_call_site_ids_ = map_item.size_; |
| 197 | } |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | uint32_t DexFile::Header::GetVersion() const { |
| 202 | const char* version = reinterpret_cast<const char*>(&magic_[kDexMagicSize]); |
nothing calls this directly
no outgoing calls
no test coverage detected