Skip to content

Commit e7bf485

Browse files
committed
JS: Add another interprocedural flow test case
1 parent 3cbd6d3 commit e7bf485

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
| exceptions.js:93:11:93:18 | source() | exceptions.js:95:10:95:10 | e |
3838
| exceptions.js:100:13:100:20 | source() | exceptions.js:102:12:102:12 | e |
3939
| exceptions.js:115:21:115:28 | source() | exceptions.js:121:10:121:10 | e |
40+
| exceptions.js:144:9:144:16 | source() | exceptions.js:129:10:129:10 | e |
41+
| exceptions.js:144:9:144:16 | source() | exceptions.js:132:8:132:27 | returnThrownSource() |
4042
| indexOf.js:4:11:4:18 | source() | indexOf.js:9:10:9:10 | x |
4143
| partialCalls.js:4:17:4:24 | source() | partialCalls.js:17:14:17:14 | x |
4244
| partialCalls.js:4:17:4:24 | source() | partialCalls.js:20:14:20:14 | y |

javascript/ql/test/library-tests/TaintTracking/exceptions.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,26 @@ function testNesting(x) {
122122
}
123123
}
124124

125+
function testThrowSourceInCallee() {
126+
try {
127+
throwSource();
128+
} catch (e) {
129+
sink(e); // NOT OK
130+
}
131+
132+
sink(returnThrownSource()); // NOT OK
133+
}
134+
135+
function returnThrownSource() {
136+
try {
137+
throwSource();
138+
} catch (e) {
139+
return e;
140+
}
141+
}
142+
143+
function throwSource() {
144+
throw source();
145+
}
146+
125147
// semmle-extractor-options: --experimental

0 commit comments

Comments
 (0)