private boolean shouldWrapArgument(ProgramState.SymbolicValueSymbol argument, ExpressionTree argumentTree) { ResourceConstraint argConstraint = programState.getConstraint(argument.symbolicValue(), ResourceConstraint.class); return (argConstraint == OPEN && argument.symbol() != null) || (argConstraint == null && isCloseable(argumentTree)); }
private void enqueueHappyPath(ProgramState programState, MethodInvocationTree mit, MethodYield yield) { checkerDispatcher.syntaxNode = mit; checkerDispatcher.methodYield = yield; checkerDispatcher.addTransition(programState); checkerDispatcher.methodYield = null; clearStack(mit); }
void enqueue(ProgramPoint pp, ProgramState programState) { int nbOfExecution = programState.numberOfTimeVisited(pp); if (nbOfExecution > MAX_EXEC_PROGRAM_POINT) { return; } ProgramState ps = programState.visitedPoint(pp, nbOfExecution + 1); ExplodedGraph.Node cachedNode = explodedGraph.node(pp, ps); cachedNode.addParent(node, null); if (cachedNode.isNew()) { workList.addFirst(cachedNode); } }
private static Set<Flow> flowFromNode(ExplodedGraph.Node node) { List<Class<? extends Constraint>> domains = Lists.newArrayList(ObjectConstraint.class, BooleanConstraint.class); return FlowComputation.flow(node.parent(), node.programState.peekValue(), domains, node.programState.peekValueSymbol().symbol); }
PreStatementVisitor(CheckerContext context) { super(context.getState()); this.context = context; this.constraintManager = context.getConstraintManager(); }
@Override public void checkEndOfExecution(CheckerContext context) { AlwaysTrueOrFalseExpressionCollector atof = context.alwaysTrueOrFalseExpressions(); for (Tree condition : atof.alwaysFalse()) { reportBooleanExpression(context, atof, condition, false); } for (Tree condition : atof.alwaysTrue()) { reportBooleanExpression(context, atof, condition, true); } }
private boolean shouldCloseArgument(ProgramState.SymbolicValueSymbol argument) { ResourceConstraint argConstraint = programState.getConstraint(argument.symbolicValue(), ResourceConstraint.class); return argConstraint == OPEN; }
private static ProgramState removeNotConsumedConstraints(ProgramState programState) { ProgramState intermediateState = programState; for (SymbolicValue notConsumed : intermediateState.getValuesWithConstraints(StreamPipelineConstraint.NOT_CONSUMED)) { intermediateState = intermediateState.removeConstraintsOnDomain(notConsumed, StreamPipelineConstraint.class); } return intermediateState; }
private static ProgramState setDoubleOrLong(ProgramState programState, SymbolicValue sv, boolean value) { if (value) { return programState.addConstraint(sv, LONG_OR_DOUBLE); } else { return programState.removeConstraintsOnDomain(sv, StackValueCategoryConstraint.class); } }
@VisibleForTesting protected ExplodedGraphWalker(List<SECheck> seChecks, BehaviorCache behaviorCache, SemanticModel semanticModel) { this.alwaysTrueOrFalseExpressionCollector = new AlwaysTrueOrFalseExpressionCollector(); this.checkerDispatcher = new CheckerDispatcher(this, seChecks); this.behaviorCache = behaviorCache; this.semanticModel = semanticModel; }
private void interrupted(Exception cause) { handleEndOfExecutionPath(true); checkerDispatcher.interruptedExecution(cause); }
void enqueue(ProgramPoint pp, ProgramState programState) { int nbOfExecution = programState.numberOfTimeVisited(pp); if (nbOfExecution > MAX_EXEC_PROGRAM_POINT) { return; } ProgramState ps = programState.visitedPoint(pp, nbOfExecution + 1); ExplodedGraph.Node cachedNode = explodedGraph.node(pp, ps); cachedNode.addParent(node, null); if (cachedNode.isNew()) { workList.addFirst(cachedNode); } }
private boolean shouldWrapArgument(ProgramState.SymbolicValueSymbol argument, ExpressionTree argumentTree) { ResourceConstraint argConstraint = programState.getConstraint(argument.symbolicValue(), ResourceConstraint.class); return (argConstraint == OPEN && argument.symbol() != null) || (argConstraint == null && isCloseable(argumentTree)); }
private void enqueueHappyPath(ProgramState programState, MethodInvocationTree mit, MethodYield yield) { checkerDispatcher.syntaxNode = mit; checkerDispatcher.methodYield = yield; checkerDispatcher.addTransition(programState); checkerDispatcher.methodYield = null; clearStack(mit); }
private boolean shouldCloseArgument(ProgramState.SymbolicValueSymbol argument) { ResourceConstraint argConstraint = programState.getConstraint(argument.symbolicValue(), ResourceConstraint.class); return argConstraint == OPEN; }
private void interrupted(Exception cause) { handleEndOfExecutionPath(true); checkerDispatcher.interruptedExecution(cause); }