Update DeclarationOfVariableWithUnnecessarilyWideScope.ql

This commit is contained in:
ihsinme
2021-05-05 23:34:21 +03:00
committed by GitHub
parent b277082462
commit 976ccda135

View File

@@ -1,7 +1,7 @@
/**
* @name Errors When Using Variable Declaration Inside Loop
* @description Using variables with the same name is dangerous.
* However, such a situation inside the while loop can lead to a violation of the accessibility of the program.
* However, such a situation inside the while loop can create an infinite loop exhausting resources.
* Requires the attention of developers.
* @kind problem
* @id cpp/errors-when-using-variable-declaration-inside-loop
@@ -37,7 +37,7 @@ class DangerousWhileLoop extends WhileStmt {
/** Holds when there are changes to the variables involved in the condition. */
predicate isUseThisVariable() {
exists(Variable v |
this.getCondition().getAChild*().(VariableAccess).getTarget() = v and
exp.(VariableAccess).getTarget() = v and
(
exists(Assignment aexp |
aexp = this.getStmt().getAChild*() and