Skip to content

Commit

Permalink
fix ConcurrentModificationException when calling SootClass.getMethods…
Browse files Browse the repository at this point in the history
…ByNameAndParamCount bug
  • Loading branch information
buriedpot committed Jan 17, 2024
1 parent 395b878 commit 4056d91
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/java/soot/SootClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -1304,12 +1304,14 @@ public boolean isOpenedByModule() {
*/
public Collection<SootMethod> getMethodsByNameAndParamCount(String name, int paramCount) {
List<SootMethod> result = null;
for (SootMethod m : getMethods()) {
if (m.getParameterCount() == paramCount && m.getName().equals(name)) {
if (result == null) {
result = new ArrayList<>();
synchronized(this) {
for (SootMethod m : getMethods()) {
if (m.getParameterCount() == paramCount && m.getName().equals(name)) {
if (result == null) {
result = new ArrayList<>();
}
result.add(m);
}
result.add(m);
}
}

Expand Down

0 comments on commit 4056d91

Please sign in to comment.