alibaba / alibaba/AndFix

apkpatch.jar工具中,类DexDiffer可能有误

Open
#175 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
7k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

```
public DiffInfo diff(File newFile, File oldFile) throws IOException {
...
boolean contains = false;
for (DexBackedClassDef newClazz : newDexFile.getClasses()) {
for (DexBackedClassDef oldClazz : oldDexFile.getClasses()) {
if (newClazz.equals(oldClazz)) {
compareField(newClazz, oldClazz, info);
compareMethod(newClazz, oldClazz, info);
contains = true;
break;
}
}
if (!contains) {
info.addAddedClasses(newClazz);
}
}
return info;
}
```

如果contains第一次变为true,`info.addAddedClasses(newClazz);`就再也得不到执行。应该将`boolean contains = false;`移动到第一个for块里面。

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the DexDiffer.diff entry point in the apkpatch.jar tool and inspect how the contains flag is scoped across new classes. Verify the behavior with a diff containing multiple new classes, ensuring each class is classified independently and all added classes are reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.