Skip to content

Commit 3c885f3

Browse files
committed
JS: Fix bug in MkClassInstance use-nodes
This only worked when the RHS was a SourceNode, which is not generally the case
1 parent 5e7026c commit 3c885f3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

javascript/ql/lib/semmle/javascript/ApiGraphs.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ module API {
13191319
succ = MkDef(rhs)
13201320
or
13211321
exists(DataFlow::ClassNode cls |
1322-
cls.getAnInstanceReference() = rhs and
1322+
cls.getAnInstanceReference().flowsTo(rhs) and
13231323
succ = MkClassInstance(cls)
13241324
)
13251325
)

javascript/ql/test/library-tests/ModelGeneration/ModelGeneration.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ typeModel
55
| (aliases).Alias1 | aliases | Member[Alias4].Member[x].Member[x] |
66
| (aliases).Alias1 | aliases | Member[AliasedClass] |
77
| (aliases).Alias1.prototype | (aliases).Alias1 | Instance |
8+
| (aliases).Alias1.prototype | (aliases).Alias1.prototype.foo | ReturnValue |
89
| (aliases).Alias1.prototype.foo | (aliases).Alias1.prototype | Member[foo] |
910
| (long-access-path).a.shortcut.d | long-access-path | Member[a].Member[b].Member[c].Member[d] |
1011
| (long-access-path).a.shortcut.d | long-access-path | Member[a].Member[shortcut].Member[d] |
@@ -14,6 +15,7 @@ typeModel
1415
| (return-this).FluentInterface.prototype | (return-this).FluentInterface | Instance |
1516
| (return-this).FluentInterface.prototype | (return-this).FluentInterface.prototype.bar | ReturnValue |
1617
| (return-this).FluentInterface.prototype | (return-this).FluentInterface.prototype.baz | ReturnValue |
18+
| (return-this).FluentInterface.prototype | (return-this).FluentInterface.prototype.foo | ReturnValue |
1719
| (return-this).FluentInterface.prototype.bar | (return-this).FluentInterface.prototype | Member[bar] |
1820
| (return-this).FluentInterface.prototype.baz | (return-this).FluentInterface.prototype | Member[baz] |
1921
| (return-this).FluentInterface.prototype.foo | (return-this).FluentInterface.prototype | Member[foo] |

0 commit comments

Comments
 (0)