Skip to content

Commit 9833d39

Browse files
committed
SSA: Restrict size of TNode
1 parent 13c109c commit 9833d39

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

shared/ssa/codeql/ssa/Ssa.qll

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,14 @@ module Make<LocationSig Location, InputSig<Location> Input> {
12241224
module DataFlowIntegration<DataFlowIntegrationInputSig DfInput> {
12251225
private import codeql.util.Boolean
12261226

1227-
final private class DefinitionExtFinal = DefinitionExt;
1227+
pragma[nomagic]
1228+
private DfInput::Expr getARead(Definition def) {
1229+
exists(SourceVariable v, BasicBlock bb, int i |
1230+
ssaDefReachesRead(v, def, bb, i) and
1231+
variableRead(bb, i, v, true) and
1232+
result.hasCfgNode(bb, i)
1233+
)
1234+
}
12281235

12291236
pragma[nomagic]
12301237
private predicate adjacentDefReachesReadExt(
@@ -1291,6 +1298,8 @@ module Make<LocationSig Location, InputSig<Location> Input> {
12911298
)
12921299
}
12931300

1301+
final private class DefinitionExtFinal = DefinitionExt;
1302+
12941303
/** An SSA definition into which another SSA definition may flow. */
12951304
private class SsaInputDefinitionExt extends DefinitionExtFinal {
12961305
SsaInputDefinitionExt() {
@@ -1311,13 +1320,11 @@ module Make<LocationSig Location, InputSig<Location> Input> {
13111320

13121321
cached
13131322
private newtype TNode =
1314-
TParamNode(DfInput::Parameter p) or
1323+
TParamNode(DfInput::Parameter p) { DfInput::ssaDefInitializesParam(_, p) } or
13151324
TExprNode(DfInput::Expr e, Boolean isPost) {
1316-
exists(BasicBlock bb, int i |
1317-
variableRead(bb, i, _, true) and
1318-
e.hasCfgNode(bb, i)
1319-
)
1325+
e = getARead(_)
13201326
or
1327+
DfInput::ssaDefAssigns(_, e) and
13211328
isPost = false
13221329
} or
13231330
TSsaDefinitionNode(DefinitionExt def) or
@@ -1574,15 +1581,6 @@ module Make<LocationSig Location, InputSig<Location> Input> {
15741581
isUseStep = false
15751582
}
15761583

1577-
pragma[nomagic]
1578-
private DfInput::Expr getARead(Definition def) {
1579-
exists(SourceVariable v, BasicBlock bb, int i |
1580-
ssaDefReachesRead(v, def, bb, i) and
1581-
variableRead(bb, i, v, true) and
1582-
result.hasCfgNode(bb, i)
1583-
)
1584-
}
1585-
15861584
/** Holds if the value of `nodeTo` is given by `nodeFrom`. */
15871585
predicate localMustFlowStep(DefinitionExt def, Node nodeFrom, Node nodeTo) {
15881586
(

0 commit comments

Comments
 (0)