Skip to content

Commit 97b2bda

Browse files
committed
Java: Fix types of summary parameter nodes.
1 parent b2d3f29 commit 97b2bda

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

java/ql/lib/semmle/code/java/dataflow/internal/DataFlowNodes.qll

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ module Public {
127127
or
128128
result = this.(ImplicitPostUpdateNode).getPreUpdateNode().getType()
129129
or
130-
result = this.(SummaryParameterNode).getTypeImpl()
131-
or
132130
result = this.(FieldValueNode).getField().getType()
133131
}
134132

@@ -492,10 +490,6 @@ module Private {
492490
override predicate isParameterOf(DataFlowCallable c, int pos) {
493491
c.asSummarizedCallable() = this.getSummarizedCallable() and pos = this.getPosition()
494492
}
495-
496-
Type getTypeImpl() {
497-
result = this.getSummarizedCallable().getParameterType(this.getPosition())
498-
}
499493
}
500494
}
501495

java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,9 @@ module Private {
505505
or
506506
// Add the post-update node corresponding to the requested argument node
507507
outputState(c, s) and isCallbackParameter(s)
508+
or
509+
// Add the parameter node for parameter side-effects
510+
outputState(c, s) and s = SummaryComponentStack::argument(_)
508511
}
509512

510513
private newtype TSummaryNodeState =
@@ -713,6 +716,11 @@ module Private {
713716
head = TSyntheticGlobalSummaryComponent(sg) and
714717
result = getSyntheticGlobalType(sg)
715718
)
719+
or
720+
exists(ParameterPosition pos |
721+
head = TArgumentSummaryComponent(pos) and
722+
result = getParameterType(c, pos)
723+
)
716724
)
717725
or
718726
n = summaryNodeOutputState(c, s) and

java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImplSpecific.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ SummaryCall summaryDataFlowCall(SummaryNode receiver) { result.getReceiver() = r
3232
/** Gets the type of content `c`. */
3333
DataFlowType getContentType(Content c) { result = c.getType() }
3434

35+
/** Gets the type of the parameter at the given position. */
36+
DataFlowType getParameterType(SummarizedCallable c, ParameterPosition pos) {
37+
result = getErasedRepr(c.getParameterType(pos))
38+
}
39+
3540
/** Gets the return type of kind `rk` for callable `c`. */
3641
DataFlowType getReturnType(SummarizedCallable c, ReturnKind rk) {
3742
result = getErasedRepr(c.getReturnType()) and

0 commit comments

Comments
 (0)