Skip to content

Commit 7871fb8

Browse files
committed
Data flow: Block flow at expectsContents nodes in parameterValueFlow
1 parent 137594c commit 7871fb8

File tree

2 files changed

+31
-29
lines changed

2 files changed

+31
-29
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
| regressions.rb:2:1:2:9 | [post] call to reverse | regressions.rb:3:6:3:6 | x |

shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -863,34 +863,37 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
863863
*/
864864
pragma[nomagic]
865865
private predicate parameterValueFlowCand(ParamNode p, Node node, boolean read) {
866-
p = node and
867-
read = false
868-
or
869-
// local flow
870-
exists(Node mid |
871-
parameterValueFlowCand(p, mid, read) and
872-
simpleLocalFlowStep(mid, node) and
873-
validParameterAliasStep(mid, node)
874-
)
875-
or
876-
// read
877-
exists(Node mid |
878-
parameterValueFlowCand(p, mid, false) and
879-
readSet(mid, _, node) and
880-
read = true
881-
)
882-
or
883-
// flow through: no prior read
884-
exists(ArgNode arg |
885-
parameterValueFlowArgCand(p, arg, false) and
886-
argumentValueFlowsThroughCand(arg, node, read)
887-
)
888-
or
889-
// flow through: no read inside method
890-
exists(ArgNode arg |
891-
parameterValueFlowArgCand(p, arg, read) and
892-
argumentValueFlowsThroughCand(arg, node, false)
893-
)
866+
(
867+
p = node and
868+
read = false
869+
or
870+
// local flow
871+
exists(Node mid |
872+
parameterValueFlowCand(p, mid, read) and
873+
simpleLocalFlowStep(mid, node) and
874+
validParameterAliasStep(mid, node)
875+
)
876+
or
877+
// read
878+
exists(Node mid |
879+
parameterValueFlowCand(p, mid, false) and
880+
readSet(mid, _, node) and
881+
read = true
882+
)
883+
or
884+
// flow through: no prior read
885+
exists(ArgNode arg |
886+
parameterValueFlowArgCand(p, arg, false) and
887+
argumentValueFlowsThroughCand(arg, node, read)
888+
)
889+
or
890+
// flow through: no read inside method
891+
exists(ArgNode arg |
892+
parameterValueFlowArgCand(p, arg, read) and
893+
argumentValueFlowsThroughCand(arg, node, false)
894+
)
895+
) and
896+
not expectsContentCached(node, _)
894897
}
895898

896899
pragma[nomagic]

0 commit comments

Comments
 (0)