| 2901 | // underscored variants in the DexFileVerifier. |
| 2902 | |
| 2903 | static std::string GetStringOrError(const uint8_t* const begin, |
| 2904 | const DexFile::Header* const header, |
| 2905 | dex::StringIndex string_idx) { |
| 2906 | // The `string_idx` is not guaranteed to be valid yet. |
| 2907 | if (header->string_ids_size_ <= string_idx.index_) { |
| 2908 | return "(error)"; |
| 2909 | } |
| 2910 | |
| 2911 | const DexFile::StringId* string_id = |
| 2912 | reinterpret_cast<const DexFile::StringId*>(begin + header->string_ids_off_) |
| 2913 | + string_idx.index_; |
| 2914 | |
| 2915 | // Assume that the data is OK at this point. String data has been checked at this point. |
| 2916 | |
| 2917 | const uint8_t* ptr = begin + string_id->string_data_off_; |
| 2918 | uint32_t dummy; |
| 2919 | if (!DecodeUnsignedLeb128Checked(&ptr, begin + header->file_size_, &dummy)) { |
| 2920 | return "(error)"; |
| 2921 | } |
| 2922 | return reinterpret_cast<const char*>(ptr); |
| 2923 | } |
| 2924 | |
| 2925 | static std::string GetClassOrError(const uint8_t* const begin, |
| 2926 | const DexFile::Header* const header, |
no test coverage detected