Skip to content

Commit 95b95e5

Browse files
committed
Dataflow: Duplicate type info for AccessPathApprox tails.
1 parent 52f50b8 commit 95b95e5

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,8 +2412,8 @@ module Impl<FullStateConfigSig Config> {
24122412
Stage4::consCand(tc, t, TFrontNil(t)) and
24132413
not expensiveLen2unfolding(tc)
24142414
} or
2415-
TConsCons(TypedContent tc1, TypedContent tc2, int len) {
2416-
Stage4::consCand(tc1, _, TFrontHead(tc2)) and
2415+
TConsCons(TypedContent tc1, DataFlowType t, TypedContent tc2, int len) {
2416+
Stage4::consCand(tc1, t, TFrontHead(tc2)) and
24172417
len in [2 .. accessPathLimit()] and
24182418
not expensiveLen2unfolding(tc1)
24192419
} or
@@ -2488,10 +2488,11 @@ module Impl<FullStateConfigSig Config> {
24882488

24892489
private class AccessPathApproxConsCons extends AccessPathApproxCons, TConsCons {
24902490
private TypedContent tc1;
2491+
private DataFlowType t;
24912492
private TypedContent tc2;
24922493
private int len;
24932494

2494-
AccessPathApproxConsCons() { this = TConsCons(tc1, tc2, len) }
2495+
AccessPathApproxConsCons() { this = TConsCons(tc1, t, tc2, len) }
24952496

24962497
override string toString() {
24972498
if len = 2
@@ -2509,9 +2510,9 @@ module Impl<FullStateConfigSig Config> {
25092510

25102511
override predicate isCons(TypedContent head, DataFlowType typ, AccessPathApprox tail) {
25112512
head = tc1 and
2512-
typ = tc2.getContainerType() and
2513+
typ = t and
25132514
(
2514-
tail = TConsCons(tc2, _, len - 1)
2515+
tail = TConsCons(tc2, _, _, len - 1)
25152516
or
25162517
len = 2 and
25172518
tail = TConsNil(tc2, _)
@@ -2545,7 +2546,7 @@ module Impl<FullStateConfigSig Config> {
25452546
head = tc and
25462547
(
25472548
exists(TypedContent tc2 | Stage4::consCand(tc, typ, TFrontHead(tc2)) |
2548-
tail = TConsCons(tc2, _, len - 1)
2549+
tail = TConsCons(tc2, _, _, len - 1)
25492550
or
25502551
len = 2 and
25512552
tail = TConsNil(tc2, _)
@@ -2940,7 +2941,7 @@ module Impl<FullStateConfigSig Config> {
29402941
override AccessPathApproxCons getApprox() {
29412942
result = TConsNil(head_, t) and tail_ instanceof AccessPathNil
29422943
or
2943-
result = TConsCons(head_, tail_.getHead(), this.length())
2944+
result = TConsCons(head_, t, tail_.getHead(), this.length())
29442945
or
29452946
result = TCons1(head_, this.length())
29462947
}
@@ -3002,7 +3003,7 @@ module Impl<FullStateConfigSig Config> {
30023003
override AccessPathFrontHead getFront() { result = TFrontHead(head1) }
30033004

30043005
override AccessPathApproxCons getApprox() {
3005-
result = TConsCons(head1, head2, len) or
3006+
result = TConsCons(head1, t, head2, len) or
30063007
result = TCons1(head1, len)
30073008
}
30083009

0 commit comments

Comments
 (0)