dexposed icon indicating copy to clipboard operation
dexposed copied to clipboard

occur crash

Open xalexchen opened this issue 10 years ago • 4 comments

1.when i hook a method which inside has try-catch blocked,when catch blocked raise will lead app directly crash. 2. if inside call back method beforeHookMethod we create a exception object (new Exception()) also will cause app directly crash.it's any way to avoid or fixed it ?

xalexchen avatar Dec 01 '15 12:12 xalexchen

plz refer https://github.com/alibaba/dexposed/blob/master/dexposed/src/main/java/com/taobao/android/dexposed/DexposedBridge.java#L222 and https://github.com/alibaba/dexposed/blob/master/dexposed/src/main/java/com/taobao/android/dexposed/DexposedBridge.java#L256 when before and after method occur exception,it should be catched!

and if the orignal method crash,it only try catch InvocationTargetException,(https://github.com/alibaba/dexposed/blob/master/dexposed/src/main/java/com/taobao/android/dexposed/DexposedBridge.java#L243), so you should try catch your exception in your orignal method.

hwjump avatar Dec 02 '15 06:12 hwjump

what i means is if the target method has try-catch blocked. will directly crash VM

example :

protected void beforeHookedMethod(MethodHookParam param) throws Throwable { String a = null; try { a.toString(); } catch (Exception e) { e.printStackTrace(); } Log.i("dexposed", "before"); } as you can see,we already try-catch null point exception.but when VM try to fillStackTrace will lead VM directly crashed. make sense and any help ? and the Crash log like this :

backtrace: 12-22 14:32:55.134 I/DEBUG ( 424): #00 pc 002324ee /system/lib/libart.so (art::CountStackDepthVisitor::VisitFrame()+297) 12-22 14:32:55.134 I/DEBUG ( 424): #01 pc 0022da3d /system/lib/libart.so (art::StackVisitor::WalkStack(bool)+272) 12-22 14:32:55.135 I/DEBUG ( 424): #02 pc 002388d9 /system/lib/libart.so (_jobject* art::Thread::CreateInternalStackTrace(art::ScopedObjectAccessAlreadyRunnable const&) const+76)

xalexchen avatar Dec 22 '15 06:12 xalexchen

Could you tell me your phone type,and the android verison?

hwjump avatar Dec 23 '15 12:12 hwjump

nexus 5 . android 5.0

xalexchen avatar Dec 23 '15 12:12 xalexchen