diff --git a/src/bytecodeparser/CodeParser.java b/src/bytecodeparser/CodeParser.java index 9df1c6e..18d8a1d 100644 --- a/src/bytecodeparser/CodeParser.java +++ b/src/bytecodeparser/CodeParser.java @@ -50,7 +50,9 @@ public void parse(OpHandler opHandler) throws BadBytecode { if(stop) break; int index = context.iterator.next(); - Op op = Opcodes.OPCODES.get(context.iterator.byteAt(index)).init(context, index); + Op opcode = Opcodes.OPCODES.get(context.iterator.byteAt(index)); + if(opcode == null) continue; + Op op = opcode.init(context, index); opHandler.handle(op, index); } } @@ -86,4 +88,4 @@ public void begin() { public void stop() { stop = true; } -} \ No newline at end of file +} diff --git a/src/bytecodeparser/analysis/decoders/DecodedMethodInvocationOp.java b/src/bytecodeparser/analysis/decoders/DecodedMethodInvocationOp.java index d7d5fca..879a3da 100644 --- a/src/bytecodeparser/analysis/decoders/DecodedMethodInvocationOp.java +++ b/src/bytecodeparser/analysis/decoders/DecodedMethodInvocationOp.java @@ -106,7 +106,7 @@ public void simulate(Stack stack) { se = stack.pop2(); else se = stack.pop(); } - if(op.as(MethodInvocationOpcode.class).isInstanceMethod()) + if (op.as(MethodInvocationOpcode.class).isInstanceMethod() && !stack.isEmpty()) stack.pop(); if(returnTypeLength != null) { if(returnTypeLength == DOUBLE) @@ -326,4 +326,4 @@ public MethodParam[] merge() { return result; } } -} \ No newline at end of file +} diff --git a/src/bytecodeparser/analysis/stack/StackAnalyzer.java b/src/bytecodeparser/analysis/stack/StackAnalyzer.java index 6763127..6e41bb6 100644 --- a/src/bytecodeparser/analysis/stack/StackAnalyzer.java +++ b/src/bytecodeparser/analysis/stack/StackAnalyzer.java @@ -113,7 +113,9 @@ void analyze(int from, Stack stack) throws BadBytecode { Stack currentStack = stack.copy(); while(iterator.hasNext()) { int index = iterator.next(); - Op op = Opcodes.OPCODES.get(iterator.byteAt(index)).init(context, index); + Op opcode = Opcodes.OPCODES.get(iterator.byteAt(index)); + if(opcode == null) continue; + Op op = opcode.init(context, index); trace.append("\n").append(index).append(":").append(op.getName()).append(" --> "); Frame frame = frames[index]; frame.isAccessible = true; @@ -332,4 +334,4 @@ protected void updateCursors(int pos, int length) { } } } -} \ No newline at end of file +}