mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Merge pull request #11565 from asgerf/js/rephined-variable-in-access-path
JS: handle rephined variable in access path
This commit is contained in:
@@ -45,6 +45,8 @@ private PropAccess namedPropAccess(AccessPath base, PropertyName name, BasicBloc
|
||||
|
||||
private SsaVariable getRefinedVariable(SsaVariable variable) {
|
||||
result = variable.getDefinition().(SsaRefinementNode).getAnInput()
|
||||
or
|
||||
result = variable.getDefinition().(SsaPhiNode).getRephinedVariable()
|
||||
}
|
||||
|
||||
private SsaVariable getARefinementOf(SsaVariable variable) { variable = getRefinedVariable(result) }
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import * as dummy from 'dummy';
|
||||
|
||||
function oneUse() {
|
||||
let taint = source();
|
||||
|
||||
if (!isSafe(taint)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let array = [];
|
||||
if (taint) {
|
||||
array.push(taint);
|
||||
}
|
||||
|
||||
sink(array.join()); // OK
|
||||
}
|
||||
|
||||
function secondUse() {
|
||||
let taint = source();
|
||||
|
||||
if (!isSafe(taint)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let array = [];
|
||||
if (taint) {
|
||||
array.push(taint);
|
||||
}
|
||||
if (taint) {
|
||||
array.push(taint);
|
||||
}
|
||||
|
||||
sink(array.join()); // OK
|
||||
}
|
||||
Reference in New Issue
Block a user