-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle methods with all NOPs (#744)
- Loading branch information
Showing
6 changed files
with
122 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package jadx.core.dex.attributes; | ||
|
||
public enum AFlag { | ||
MTH_ENTER_BLOCK, | ||
TRY_ENTER, | ||
TRY_LEAVE, | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
jadx-core/src/test/java/jadx/tests/integration/others/TestAllNops.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package jadx.tests.integration.others; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import jadx.core.dex.nodes.ClassNode; | ||
import jadx.tests.api.SmaliTest; | ||
|
||
import static jadx.tests.api.utils.JadxMatchers.containsLines; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
public class TestAllNops extends SmaliTest { | ||
|
||
@Test | ||
public void test() { | ||
disableCompilation(); | ||
ClassNode cls = getClassNodeFromSmali(); | ||
String code = cls.getCode().toString(); | ||
|
||
assertThat(code, containsLines(1, "private boolean test() {", "}")); | ||
assertThat(code, containsLines(1, "private boolean testWithTryCatch() {", "}")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
.class public Lothers/TestAllNops; | ||
.super Ljava/lang/Object; | ||
|
||
.method public constructor <init>()V | ||
.registers 1 | ||
|
||
.line 55 | ||
nop | ||
|
||
nop | ||
|
||
nop | ||
|
||
nop | ||
.end method | ||
|
||
.method private test()Z | ||
.registers 11 | ||
|
||
.line 1480 | ||
nop | ||
|
||
nop | ||
|
||
.line 1481 | ||
nop | ||
|
||
nop | ||
|
||
nop | ||
|
||
nop | ||
|
||
nop | ||
|
||
nop | ||
|
||
.line 1485 | ||
nop | ||
|
||
nop | ||
|
||
.line 1486 | ||
nop | ||
|
||
nop | ||
|
||
.line 1487 | ||
nop | ||
|
||
.end method | ||
|
||
.method private testWithTryCatch()Z | ||
.registers 11 | ||
|
||
.line 1480 | ||
:try_start_0 | ||
nop | ||
nop | ||
|
||
.line 1481 | ||
nop | ||
|
||
nop | ||
|
||
nop | ||
|
||
nop | ||
|
||
nop | ||
|
||
nop | ||
|
||
.line 1485 | ||
nop | ||
|
||
nop | ||
|
||
:try_end_35 | ||
.catch Ljava/security/NoSuchAlgorithmException; {:try_start_0 .. :try_end_35} :catch_36 | ||
|
||
nop | ||
|
||
.line 1547 | ||
:catch_36 | ||
|
||
nop | ||
|
||
.line 1487 | ||
nop | ||
|
||
.end method |