@Override public void analyzeInstruction(Instruction ins) throws DataflowAnalysisException { instanceOfFollowedByBranch = false; sawEffectiveInstanceOf = false; super.analyzeInstruction(ins); previousWasEffectiveInstanceOf = sawEffectiveInstanceOf; }
/** * Model the stack for instructions handled by handleNormalInstruction(). * Subclasses may override to provide analysis-specific behavior. * * @param ins * the Instruction to model * @param numWordsConsumed * number of stack words consumed * @param numWordsProduced * number of stack words produced */ public void modelNormalInstruction(Instruction ins, int numWordsConsumed, int numWordsProduced) { modelInstruction(ins, numWordsConsumed, numWordsProduced, getDefaultValue()); }
/** * This is called to handle any instruction which does not simply copy * values between stack slots. The default value is pushed (if the * instruction is a stack producer). */ public void handleNormalInstruction(Instruction ins) { modelNormalInstruction(ins, getNumWordsConsumed(ins), getNumWordsProduced(ins)); }
@Override public void visitFADD(FADD obj) { handleNormalInstruction(obj); } }
@Override public void visitILOAD(ILOAD obj) { handleLoadInstruction(obj); }
@Override public void visitDSTORE(DSTORE obj) { handleStoreInstruction(obj); }
@Override public void visitGETSTATIC(GETSTATIC obj) { if (getNumWordsProduced(obj) != 1) { super.visitGETSTATIC(obj); return; } else { super.visitGETSTATIC(obj);
@Override public void visitBREAKPOINT(BREAKPOINT obj) { illegalBytecode(obj); }
@Override public void visitIXOR(IXOR obj) { handleNormalInstruction(obj); } @Override
@Override public void visitDLOAD(DLOAD obj) { handleLoadInstruction(obj); }
@Override public void visitISTORE(ISTORE obj) { handleStoreInstruction(obj); }
@Override public void visitGETSTATIC(GETSTATIC obj) { // Scala uses some classes to represent null instances of objects // If we find one of them, we will handle it as a Java Null if (obj.getLoadClassType(getCPG()).getSignature().equals("Lscala/collection/immutable/Nil$;")) { if (FindSecBugsGlobalConfig.getInstance().isDebugTaintState()) { getFrame().pushValue(new Taint(Taint.State.NULL).setDebugInfo("NULL")); } else { getFrame().pushValue(new Taint(Taint.State.NULL)); } } else { super.visitGETSTATIC(obj); } }
@Override public void visitIMPDEP1(IMPDEP1 obj) { illegalBytecode(obj); }
@Override public void visitCHECKCAST(CHECKCAST obj) { handleNormalInstruction(obj); }
/** * This is called to handle any instruction which does not simply copy * values between stack slots. The default value is pushed (if the * instruction is a stack producer). */ public void handleNormalInstruction(Instruction ins) { modelNormalInstruction(ins, getNumWordsConsumed(ins), getNumWordsProduced(ins)); }
@Override public void analyzeInstruction(Instruction ins) throws DataflowAnalysisException { if (!getFrame().isValid()) { return; } slotContainingNewNullValue = -1; super.analyzeInstruction(ins); if (!getFrame().isValid()) { return; } if (!NO_ASSERT_HACK) { if (assertionMethods.isAssertionHandle(getLocation().getHandle(), cpg)) { IsNullValueFrame frame = getFrame(); for (int i = 0; i < frame.getNumSlots(); ++i) { IsNullValue value = frame.getValue(i); if (value.isDefinitelyNull() || value.isNullOnSomePath()) { frame.setValue(i, IsNullValue.nonReportingNotNullValue()); } } for (Map.Entry<ValueNumber, IsNullValue> e : frame.getKnownValueMapEntrySet()) { IsNullValue value = e.getValue(); if (value.isDefinitelyNull() || value.isNullOnSomePath()) { e.setValue(IsNullValue.nonReportingNotNullValue()); } } } } }
@Override public void visitLLOAD(LLOAD obj) { handleLoadInstruction(obj); }
@Override public void visitASTORE(ASTORE obj) { handleStoreInstruction(obj); }
/** * Model the stack for instructions handled by handleNormalInstruction(). * Subclasses may override to provide analysis-specific behavior. * * @param ins * the Instruction to model * @param numWordsConsumed * number of stack words consumed * @param numWordsProduced * number of stack words produced */ public void modelNormalInstruction(Instruction ins, int numWordsConsumed, int numWordsProduced) { modelInstruction(ins, numWordsConsumed, numWordsProduced, getDefaultValue()); }
@Override public void visitGETSTATIC(GETSTATIC obj) { if (getNumWordsProduced(obj) != 1) { super.visitGETSTATIC(obj); return; } else { super.visitGETSTATIC(obj);