mirror of
https://github.com/revanced/smali.git
synced 2025-05-03 16:14:29 +02:00
Fix null start/end locations in SmaliCodeFragmentFactory.evaluateRegister
This commit is contained in:
parent
0e773cbe9b
commit
8f7d1a897d
@ -61,6 +61,7 @@ import org.jf.smalidea.psi.impl.SmaliMethod;
|
|||||||
import org.jf.smalidea.util.NameUtils;
|
import org.jf.smalidea.util.NameUtils;
|
||||||
import org.jf.smalidea.util.PsiUtil;
|
import org.jf.smalidea.util.PsiUtil;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -274,6 +275,7 @@ public class SmaliCodeFragmentFactory extends DefaultCodeFragmentFactory {
|
|||||||
return originalContext;
|
return originalContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public static Value evaluateRegister(EvaluationContext context, final SmaliMethod smaliMethod,
|
public static Value evaluateRegister(EvaluationContext context, final SmaliMethod smaliMethod,
|
||||||
final int registerNum, final String type) throws EvaluateException {
|
final int registerNum, final String type) throws EvaluateException {
|
||||||
|
|
||||||
@ -308,12 +310,21 @@ public class SmaliCodeFragmentFactory extends DefaultCodeFragmentFactory {
|
|||||||
for (SmaliInstruction instruction: smaliMethod.getInstructions()) {
|
for (SmaliInstruction instruction: smaliMethod.getInstructions()) {
|
||||||
methodSize += instruction.getInstructionSize();
|
methodSize += instruction.getInstructionSize();
|
||||||
}
|
}
|
||||||
Location endLocation = method.locationOfCodeIndex((methodSize/2) - 1);
|
Location endLocation = null;
|
||||||
|
for (int endCodeIndex = (methodSize/2) - 1; endCodeIndex >= 0; endCodeIndex--) {
|
||||||
|
endLocation = method.locationOfCodeIndex(endCodeIndex);
|
||||||
|
if (endLocation != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (endLocation == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
LocalVariable localVariable = localVariableConstructor.newInstance(vm,
|
LocalVariable localVariable = localVariableConstructor.newInstance(vm,
|
||||||
method,
|
method,
|
||||||
mapRegister(frameProxy.getStackFrame().virtualMachine(), smaliMethod, registerNum),
|
mapRegister(frameProxy.getStackFrame().virtualMachine(), smaliMethod, registerNum),
|
||||||
method.locationOfCodeIndex(0),
|
method.location(),
|
||||||
endLocation,
|
endLocation,
|
||||||
String.format("v%d", registerNum), type, null);
|
String.format("v%d", registerNum), type, null);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user