Skip to content

Commit

Permalink
Check constant pool size
Browse files Browse the repository at this point in the history
Summary: As title.

Reviewed By: NTillmann

Differential Revision: D66314392

fbshipit-source-id: 3684bdb5ae8b8f42ad70a3fc1867ecce01299ed0
  • Loading branch information
agampe authored and facebook-github-bot committed Nov 22, 2024
1 parent 6e8f235 commit 46c05d0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libredex/JarLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ DexType* make_dextype_from_cref(std::vector<cp_entry>& cpool, uint16_t cref) {
return nullptr;
}
uint16_t utf8ref = cpool[cref].s0;
if (utf8ref >= cpool.size()) {
std::cerr << "utf8 ref out of bound, bailing\n";
return nullptr;
}
const cp_entry& utf8cpe = cpool[utf8ref];
if (utf8cpe.tag != CP_CONST_UTF8) {
std::cerr << "Non-utf8 ref in get_utf8, Bailing\n";
Expand Down

0 comments on commit 46c05d0

Please sign in to comment.