mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
JavaScript: Deal with (un-)escaping on captured variables.
This commit is contained in:
@@ -46,7 +46,12 @@ string getStringValue(RegExpLiteral rl) {
|
||||
*/
|
||||
DataFlow::Node getASimplePredecessor(DataFlow::Node nd) {
|
||||
result = nd.getAPredecessor() and
|
||||
not nd.(DataFlow::SsaDefinitionNode).getSsaVariable().getDefinition() instanceof SsaPhiNode
|
||||
not exists(SsaDefinition ssa |
|
||||
ssa = nd.(DataFlow::SsaDefinitionNode).getSsaVariable().getDefinition()
|
||||
|
|
||||
ssa instanceof SsaPhiNode or
|
||||
ssa instanceof SsaVariableCapture
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -83,3 +83,10 @@ function badEncodeWithReplacer(s) {
|
||||
function badRoundtrip(s) {
|
||||
return s.replace(/\\\\/g, "\\").replace(/\\/g, "\\\\");
|
||||
}
|
||||
|
||||
function testWithCapturedVar(x) {
|
||||
var captured = x;
|
||||
(function() {
|
||||
captured = captured.replace(/\\/g, "\\\\");
|
||||
})();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user