Skip to content

Commit 20033b9

Browse files
authored
Merge pull request #58 from microsoft/jb1/improper-array-index
Jb1/improper array index
2 parents 9709ebb + db49d95 commit 20033b9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cpp/ql/src/Security/CWE/CWE-129/ImproperArrayIndexValidation.ql

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ predicate predictableInstruction(Instruction instr) {
6666
}
6767

6868
module ImproperArrayIndexValidationConfig implements DataFlow::ConfigSig {
69-
predicate isSource(DataFlow::Node source) { isFlowSource(source, _) }
69+
predicate isSource(DataFlow::Node source) {
70+
isFlowSource(source, _) and
71+
not source.getLocation().getFile().getRelativePath().regexpMatch("(.*/)?tests?/.*")
72+
}
7073

7174
predicate isBarrier(DataFlow::Node node) {
7275
hasUpperBound(node.asExpr())
@@ -117,7 +120,8 @@ module ImproperArrayIndexValidationConfig implements DataFlow::ConfigSig {
117120
module ImproperArrayIndexValidation = TaintTracking::Global<ImproperArrayIndexValidationConfig>;
118121

119122
from
120-
ImproperArrayIndexValidation::PathNode source, ImproperArrayIndexValidation::PathNode sink,
123+
ImproperArrayIndexValidation::PathNode source,
124+
ImproperArrayIndexValidation::PathNode sink,
121125
string sourceType
122126
where
123127
ImproperArrayIndexValidation::flowPath(source, sink) and

0 commit comments

Comments
 (0)