@@ -729,41 +729,39 @@ private predicate exprToDefinitionByReferenceStep(Expr exprIn, Expr argOut) {
729729
730730private module FieldFlow {
731731 private import DataFlowImplCommon
732- private import DataFlowImplLocal
733732 private import DataFlowPrivate
733+ private import semmle.code.cpp.dataflow.DataFlow
734734
735735 /**
736- * A configuration for finding local-only flow through fields. This uses the
737- * `Configuration` class in the dedicated `DataFlowImplLocal` copy of the
738- * shared library that's not user-exposed directly.
736+ * A configuration for finding local-only flow through fields.
739737 *
740738 * To keep the flow local to a single function, we put barriers on parameters
741739 * and return statements. Sources and sinks are the values that go into and
742740 * out of fields, respectively.
743741 */
744- private class FieldConfiguration extends Configuration {
745- FieldConfiguration ( ) { this = "FieldConfiguration" }
746-
747- override predicate isSource ( Node source ) {
742+ private module FieldConfig implements DataFlow:: ConfigSig {
743+ predicate isSource ( Node source ) {
748744 storeStep ( source , _, _)
749745 or
750746 // Also mark `foo(a.b);` as a source when `a.b` may be overwritten by `foo`.
751747 readStep ( _, _, any ( Node node | node .asExpr ( ) = source .asDefiningArgument ( ) ) )
752748 }
753749
754- override predicate isSink ( Node sink ) { readStep ( _, _, sink ) }
750+ predicate isSink ( Node sink ) { readStep ( _, _, sink ) }
755751
756- override predicate isBarrier ( Node node ) { node instanceof ParameterNode }
752+ predicate isBarrier ( Node node ) { node instanceof ParameterNode }
757753
758- override predicate isBarrierOut ( Node node ) {
754+ predicate isBarrierOut ( Node node ) {
759755 node .asExpr ( ) .getParent ( ) instanceof ReturnStmt
760756 or
761757 node .asExpr ( ) .getParent ( ) instanceof ThrowExpr
762758 }
763759 }
764760
761+ private module Flow = DataFlow:: Global< FieldConfig > ;
762+
765763 predicate fieldFlow ( Node node1 , Node node2 ) {
766- exists ( FieldConfiguration cfg | cfg . hasFlow ( node1 , node2 ) ) and
764+ Flow :: flow ( node1 , node2 ) and
767765 // This configuration should not be able to cross function boundaries, but
768766 // we double-check here just to be sure.
769767 getNodeEnclosingCallable ( node1 ) = getNodeEnclosingCallable ( node2 )
0 commit comments