Skip to content

Commit

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

Reviewed By: wsanville

Differential Revision: D66335009

fbshipit-source-id: 73b2b6478aa980b69f4397eb4711e3ed707e65e6
  • Loading branch information
agampe authored and facebook-github-bot committed Nov 22, 2024
1 parent 15b1b3a commit a7d186c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libredex/JarLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,13 @@ bool parse_class(uint8_t* buffer,
std::vector<cp_entry> cpool;
cpool.resize(cp_count);
/* The zero'th entry is always empty. Java is annoying. */
for (int i = 1; i < cp_count; i++) {
for (size_t i = 1; i < cp_count; i++) {
if (!parse_cp_entry(buffer, buffer_end, cpool[i])) return false;
if (cpool[i].tag == CP_CONST_LONG || cpool[i].tag == CP_CONST_DOUBLE) {
if (i + 1 >= cp_count) {
std::cerr << "Bad long/double constant, bailing.\n";
return false;
}
cpool[i + 1] = cpool[i];
i++;
}
Expand Down

0 comments on commit a7d186c

Please sign in to comment.