Skip to content

Commit

Permalink
fix: correct implementation of indexOf (ReVanced#5)
Browse files Browse the repository at this point in the history
LithoAdRemoval.indexOf never increments the index for the outer loop, causing an infinite loop
  • Loading branch information
lachlanwimsett committed Apr 8, 2022
1 parent 14c5d21 commit 4da0538
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,17 @@ public static int indexOf(byte[] array, byte[] target) {
return 0;
}

int i = 0;
while (i < array.length - target.length + 1 ){
for (int i = 0; i < array.length - target.length + 1; i++) {
boolean targetFound = true;
for (int j = 0; j < target.length; j++) {
if (array[i+j] != target[j]) {
targetFound = false;
break;
}
}
return i;
if (targetFound) {
return i;
}
}
return -1;
}
Expand Down

0 comments on commit 4da0538

Please sign in to comment.