File tree Expand file tree Collapse file tree 4 files changed +18
-4
lines changed
lib/semmle/javascript/dataflow/internal
test/library-tests/TypeTracking Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -450,6 +450,18 @@ private module CachedSteps {
450
450
)
451
451
}
452
452
453
+ /** Gets a function that flows to `parameter` via one or more parameter-passing steps. */
454
+ cached
455
+ DataFlow:: FunctionNode getACallbackSource ( DataFlow:: ParameterNode parameter ) {
456
+ Stages:: TypeTracking:: ref ( ) and
457
+ callStep ( result .getALocalUse ( ) , parameter )
458
+ or
459
+ exists ( DataFlow:: ParameterNode mid |
460
+ callStep ( mid .getALocalUse ( ) , parameter ) and
461
+ result = getACallbackSource ( mid )
462
+ )
463
+ }
464
+
453
465
/**
454
466
* Holds if `f` may return `base`, which has a write of property `prop` with right-hand side `rhs`.
455
467
*/
Original file line number Diff line number Diff line change @@ -158,10 +158,9 @@ private module Cached {
158
158
)
159
159
or
160
160
// Add 'return' steps from callback arguments to callback parameters
161
- exists ( DataFlow:: ParameterNode cbParam , DataFlow:: FunctionNode cbFun , int i |
162
- callStep ( cbFun , cbParam ) and
163
- pred = cbParam .getAnInvocation ( ) .getArgument ( i ) and
164
- succ = cbFun .getParameter ( i ) and
161
+ exists ( DataFlow:: ParameterNode parameter , int i |
162
+ pred = parameter .getAnInvocation ( ) .getArgument ( i ) and
163
+ succ = getACallbackSource ( parameter ) .getParameter ( i ) and
165
164
summary = ReturnStep ( )
166
165
)
167
166
}
Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ test_Connection
39
39
| tst.js:114:1:114:28 | getX({ ... on() }) |
40
40
| tst.js:114:11:114:25 | getConnection() |
41
41
| tst.js:118:12:118:26 | getConnection() |
42
+ | tst.js:120:21:120:24 | conn |
43
+ | tst.js:126:22:126:25 | conn |
42
44
| tst_conflict.js:6:38:6:77 | api.cha ... ction() |
43
45
test_DataCallback
44
46
| client.js:3:28:3:34 | x => {} |
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ connection
42
42
| type tracker without call steps | tst.js:114:11:114:25 | getConnection() |
43
43
| type tracker without call steps | tst.js:118:12:118:26 | getConnection() |
44
44
| type tracker without call steps | tst.js:120:21:120:24 | conn |
45
+ | type tracker without call steps | tst.js:126:22:126:25 | conn |
45
46
| type tracker without call steps | tst_conflict.js:6:38:6:77 | api.cha ... ction() |
46
47
| type tracker without call steps with property MyApplication.namespace.connection | file://:0:0:0:0 | global access path |
47
48
| type tracker without call steps with property conflict | tst.js:63:3:63:25 | MyAppli ... mespace |
You can’t perform that action at this time.
0 commit comments