Fix UB (#2020)
This commit is contained in:
parent
666e8780c7
commit
f29c797200
|
|
@ -79,7 +79,7 @@ public final class XposedBridge {
|
||||||
|
|
||||||
public static volatile ClassLoader dummyClassLoader = null;
|
public static volatile ClassLoader dummyClassLoader = null;
|
||||||
|
|
||||||
private static final ClassCastException castException = new ClassCastException("Return value's type from hook callback does not match the hooked method");
|
private static final String castException = "Return value's type from hook callback does not match the hooked method";
|
||||||
|
|
||||||
private static final Method getCause;
|
private static final Method getCause;
|
||||||
|
|
||||||
|
|
@ -499,7 +499,7 @@ public final class XposedBridge {
|
||||||
else {
|
else {
|
||||||
var result = param.getResult();
|
var result = param.getResult();
|
||||||
if (returnType != null && !returnType.isPrimitive() && !HookBridge.instanceOf(result, returnType)) {
|
if (returnType != null && !returnType.isPrimitive() && !HookBridge.instanceOf(result, returnType)) {
|
||||||
throw castException;
|
throw new ClassCastException(castException);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,8 @@ LSP_DEF_NATIVE_METHOD(jboolean, HookBridge, hookMethod, jobject hookMethod,
|
||||||
ptr = std::make_unique<HookItem>();
|
ptr = std::make_unique<HookItem>();
|
||||||
hook_item = ptr.get();
|
hook_item = ptr.get();
|
||||||
newHook = true;
|
newHook = true;
|
||||||
|
} else {
|
||||||
|
hook_item = ptr.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newHook) {
|
if (newHook) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue