mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
QL code and tests for C#/C++/JavaScript.
This commit is contained in:
16
cpp/ql/src/Likely Bugs/NestedLoopSameVar.cpp
Normal file
16
cpp/ql/src/Likely Bugs/NestedLoopSameVar.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
int x1 = 0;
|
||||
for (x1 = 0; x1 < 100; x1++) {
|
||||
int x2 = 0;
|
||||
for (x1 = 0; x1 < 300; x1++) {
|
||||
// this is most likely a typo
|
||||
// the outer loop will exit immediately
|
||||
}
|
||||
}
|
||||
|
||||
for (x1 = 0; x1 < 100; x1++) {
|
||||
if(x1 == 10 && condition) {
|
||||
for (; x1 < 75; x1++) {
|
||||
// this should be written as a while loop
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user