File tree Expand file tree Collapse file tree
javascript/ql/lib/semmle/javascript/dataflow/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,7 +155,12 @@ private DataFlow::SourceNode forwardedCalleeSource(
155155 exists ( DataFlow:: TypeBackTracker t2 | result = forwardedCalleeSource ( call , t2 ) .backtrack ( t2 , t ) )
156156}
157157
158- /** Data flow into a concrete function invoked through a forwarding wrapper. */
158+ /**
159+ * Data flow into a concrete function invoked through a forwarding wrapper.
160+ *
161+ * Only arguments with a statically known position and a corresponding non-rest parameter are
162+ * modeled.
163+ */
159164private class FunctionWrapperCallStep extends DataFlow:: SharedFlowStep {
160165 DataFlow:: CallNode call ;
161166 DataFlow:: FunctionNode wrapped ;
@@ -167,8 +172,11 @@ private class FunctionWrapperCallStep extends DataFlow::SharedFlowStep {
167172
168173 override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
169174 exists ( int index |
175+ // getArgument only has a result when the argument position is statically known.
170176 pred = call .getArgument ( index ) and
171- succ = wrapped .getParameter ( index )
177+ succ = wrapped .getParameter ( index ) and
178+ // A rest parameter receives an array, not the argument at this index.
179+ not succ .( DataFlow:: ParameterNode ) .isRestParameter ( )
172180 )
173181 }
174182}
You can’t perform that action at this time.
0 commit comments