@ Override public void initEntryFact ( TaintFrame fact ) { fact . setValid ( ) ; fact . clearStack ( ) ; boolean inMainMethod = isInMainMethod ( ) ; int numSlots = fact . getNumSlots ( ) ; int numLocals = fact . getNumLocals ( ) ; for ( int i = 0 ; i < numSlots ; ++ i ) { Taint value = new Taint ( Taint . State . UNKNOWN ) ; if ( i < numLocals ) { if ( i < parameterStackSize ) { int stackOffset = parameterStackSize - i - 1 ; if ( isTaintedByAnnotation ( i - 1 ) ) { value = new Taint ( Taint . State . TAINTED ) ; // this would add line number for the first instruction in the method //value.addLocation(new TaintLocation(methodDescriptor, 0,""), true); } else if ( inMainMethod ) { if ( FindSecBugsGlobalConfig . getInstance ( ) . isTaintedMainArgument ( ) ) { value = new Taint ( Taint . State . TAINTED ) ; } else { value = new Taint ( Taint . State . SAFE ) ; } } else { value . addParameter ( stackOffset ) ; } value . addSource ( new UnknownSource ( UnknownSourceType . PARAMETER , value . getState ( ) ) . setParameterIndex ( stackOffset ) ) ; } value . setVariableIndex ( i ) ; } fact . setValue ( i , value ) ; } }
Initialize the initial state of a TaintFrame .