| 2923 | } |
| 2924 | |
| 2925 | static std::string GetClassOrError(const uint8_t* const begin, |
| 2926 | const DexFile::Header* const header, |
| 2927 | dex::TypeIndex class_idx) { |
| 2928 | // The `class_idx` is either `FieldId::class_idx_` or `MethodId::class_idx_` and |
| 2929 | // it has already been checked in `DexFileVerifier::CheckClassDataItemField()` |
| 2930 | // or `DexFileVerifier::CheckClassDataItemMethod()`, respectively, to match |
| 2931 | // a valid defining class. |
| 2932 | CHECK_LT(class_idx.index_, header->type_ids_size_); |
| 2933 | |
| 2934 | const DexFile::TypeId* type_id = |
| 2935 | reinterpret_cast<const DexFile::TypeId*>(begin + header->type_ids_off_) + class_idx.index_; |
| 2936 | |
| 2937 | // Assume that the data is OK at this point. Type id offsets have been checked at this point. |
| 2938 | |
| 2939 | return GetStringOrError(begin, header, type_id->descriptor_idx_); |
| 2940 | } |
| 2941 | |
| 2942 | static std::string GetFieldDescriptionOrError(const uint8_t* const begin, |
| 2943 | const DexFile::Header* const header, |
no test coverage detected