| 1180 | } |
| 1181 | |
| 1182 | bool DexFileVerifier::CheckIntraClassDataItem() { |
| 1183 | ClassDataItemIterator it(*dex_file_, ptr_); |
| 1184 | std::unordered_set<uint32_t> direct_method_indexes; |
| 1185 | |
| 1186 | // This code is complicated by the fact that we don't directly know which class this belongs to. |
| 1187 | // So we need to explicitly search with the first item we find (either field or method), and then, |
| 1188 | // as the lookup is expensive, cache the result. |
| 1189 | bool have_class = false; |
| 1190 | dex::TypeIndex class_type_index; |
| 1191 | const DexFile::ClassDef* class_def = nullptr; |
| 1192 | |
| 1193 | // Check fields. |
| 1194 | if (!CheckIntraClassDataItemFields<true>(&it, |
| 1195 | &have_class, |
| 1196 | &class_type_index, |
| 1197 | &class_def)) { |
| 1198 | return false; |
| 1199 | } |
| 1200 | if (!CheckIntraClassDataItemFields<false>(&it, |
| 1201 | &have_class, |
| 1202 | &class_type_index, |
| 1203 | &class_def)) { |
| 1204 | return false; |
| 1205 | } |
| 1206 | |
| 1207 | // Check methods. |
| 1208 | if (!CheckIntraClassDataItemMethods<true>(&it, |
| 1209 | &direct_method_indexes, |
| 1210 | &have_class, |
| 1211 | &class_type_index, |
| 1212 | &class_def)) { |
| 1213 | return false; |
| 1214 | } |
| 1215 | if (!CheckIntraClassDataItemMethods<false>(&it, |
| 1216 | &direct_method_indexes, |
| 1217 | &have_class, |
| 1218 | &class_type_index, |
| 1219 | &class_def)) { |
| 1220 | return false; |
| 1221 | } |
| 1222 | |
| 1223 | const uint8_t* end_ptr = it.EndDataPointer(); |
| 1224 | |
| 1225 | // Check static field types against initial static values in encoded array. |
| 1226 | if (!CheckStaticFieldTypes(class_def)) { |
| 1227 | return false; |
| 1228 | } |
| 1229 | |
| 1230 | ptr_ = end_ptr; |
| 1231 | return true; |
| 1232 | } |
| 1233 | |
| 1234 | bool DexFileVerifier::CheckIntraCodeItem() { |
| 1235 | const DexFile::CodeItem* code_item = reinterpret_cast<const DexFile::CodeItem*>(ptr_); |
nothing calls this directly
no test coverage detected