Merge pull request #11565 from asgerf/js/rephined-variable-in-access-path

JS: handle rephined variable in access path
This commit is contained in:
Asger F
2022-12-07 09:26:38 +01:00
committed by GitHub
2 changed files with 36 additions and 0 deletions

View File

@@ -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) }

View File

@@ -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
}