getObject on String should really just return the string
This commit is contained in:
@@ -36,6 +36,11 @@ public abstract class Instruction
|
||||
{
|
||||
return length;
|
||||
}
|
||||
|
||||
public String getDesc(Frame frame)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void addJump(int offset)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ public class AAStore extends Instruction
|
||||
{
|
||||
Stack stack = frame.getStack();
|
||||
|
||||
ObjectInstance value = (ObjectInstance) stack.pop();
|
||||
ObjectInstance value = (ObjectInstance) stack.pop(); // Strings are objects too, so this cast fails
|
||||
int index = (int) stack.pop();
|
||||
ArrayInstance array = (ArrayInstance) stack.pop();
|
||||
|
||||
|
||||
@@ -40,6 +40,13 @@ public class InvokeStatic extends Instruction
|
||||
for (int i = count - 1; i >= 0; --i)
|
||||
args[i] = e.getStack().pop();
|
||||
|
||||
if (otherClass == null)
|
||||
{
|
||||
System.out.println("invokestatic for nonexistant class " + clazz.getName());
|
||||
e.getStack().push(this, null);
|
||||
return;
|
||||
}
|
||||
|
||||
info.sigterm.deob.Method meth = otherClass.findMethod(method.getNameAndType());
|
||||
e.getPath().invoke(meth, args);
|
||||
}
|
||||
|
||||
@@ -30,4 +30,14 @@ public class LDC_W extends Instruction
|
||||
PoolEntry entry = thisClass.getPool().getEntry(index);
|
||||
frame.getStack().push(this, entry.getObject());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getDesc(Frame frame)
|
||||
{
|
||||
ClassFile thisClass = this.getInstructions().getCode().getAttributes().getClassFile();
|
||||
PoolEntry entry = thisClass.getPool().getEntry(index);
|
||||
|
||||
return "ldc_w " + entry.getObject();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,10 @@ public class Frame
|
||||
|
||||
Instruction i = ins.findInstruction(pc);
|
||||
|
||||
String desc = i.getDesc(this);
|
||||
if (desc != null)
|
||||
System.out.println(desc);
|
||||
|
||||
try
|
||||
{
|
||||
i.execute(this);
|
||||
|
||||
@@ -21,6 +21,6 @@ public class String extends PoolEntry
|
||||
@Override
|
||||
public Object getObject()
|
||||
{
|
||||
return stringIndex;
|
||||
return this.getPool().getEntry(stringIndex).getObject();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,12 @@ public class UTF8 extends PoolEntry
|
||||
}
|
||||
|
||||
public java.lang.String getValue()
|
||||
{
|
||||
return (java.lang.String) getObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject()
|
||||
{
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user