Skip to content

Commit

Permalink
FIX: Used invalid size of ArtJump.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Obser committed Mar 19, 2015
1 parent e97a8fb commit d018132
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/main/java/de/larma/arthook/HookPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void update() {
if (hook.backup != null) {
long backupAddr = instructionHelper.toMem(
hook.backup.getEntryPointFromQuickCompiledCode());
Native.munprotect_verbose(backupAddr, instructionHelper.sizeOfDirectJump());
Native.munprotect_verbose(backupAddr, instructionHelper.sizeOfArtJump());
Native.memput_verbose(instructionHelper.createArtJump(hook.src.getAddress(),
getCallOriginal()), backupAddr);
}
Expand Down
5 changes: 5 additions & 0 deletions lib/src/main/java/de/larma/arthook/instrs/Arm32.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public byte[] createTargetJump(HookPage.Hook hook) {
return instructions;
}

@Override
public int sizeOfArtJump() {
return 16;
}

@Override
@Deprecated
public byte[] createArtJump(long artMethodAddress, long jumpTarget) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public byte[] createArtJump(ArtMethod targetMethod, int offset) {
targetMethod.getEntryPointFromQuickCompiledCode() + offset);
}

public abstract int sizeOfArtJump();

public abstract byte[] createArtJump(long artMethodAddress, long jumpTarget);

public byte[] createArtJump(ArtMethod targetMethod) {
Expand Down
5 changes: 5 additions & 0 deletions lib/src/main/java/de/larma/arthook/instrs/Thumb2.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public int sizeOfTargetJump() {
return 28;
}

@Override
public int sizeOfArtJump() {
return 16;
}

@Override
public byte[] createArtJump(long artMethodAddress, long jumpTarget) {
byte[] instructions = new byte[] {
Expand Down

0 comments on commit d018132

Please sign in to comment.