Skip to content

Commit

Permalink
Do proper access checks in convert_wildcard_type
Browse files Browse the repository at this point in the history
Reviewed By: agampe

Differential Revision: D67911253

fbshipit-source-id: 9b7f11bc715c5955ab7b2e29af1063de166a3e2d
  • Loading branch information
Nikolai Tillmann authored and facebook-github-bot committed Jan 7, 2025
1 parent 5ff1fd9 commit 558be14
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions libredex/ProguardRegex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,25 +165,24 @@ std::string convert_wildcard_type(const std::string& typ) {
}

std::string convert_wildcard_type(std::string_view typ) {
redex_assert(!typ.empty());
const std::string& desc = convert_type(typ);
// Fix up the descriptor to move Ls that occur before wildcards.
std::string wildcard_descriptor;
wildcard_descriptor.reserve(desc.size());
bool supress_semicolon = false;
bool keep_dots = false;
for (unsigned int i = 0; i < desc.size(); i++) {
if (desc[i] == 'L') {
if (desc[i] == 'L' && i + 1 < desc.size()) {
if (desc[i + 1] == '%') {
supress_semicolon = true;
continue;
}
if (desc[i + 1] == '*' && desc.size() >= i + 2 && desc[i + 2] == '*' &&
if (desc[i + 1] == '*' && i + 3 < desc.size() && desc[i + 2] == '*' &&
desc[i + 3] == '*') {
supress_semicolon = true;
continue;
}
if (desc[i + 1] == '/' && desc.size() >= i + 2 && desc[i + 2] == '/' &&
if (desc[i + 1] == '/' && i + 3 < desc.size() && desc[i + 2] == '/' &&
desc[i + 3] == '/') {
supress_semicolon = true;
keep_dots = true;
Expand Down

0 comments on commit 558be14

Please sign in to comment.