File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
cpp/ql/test/experimental/query-tests/Security/CWE/CWE-561/semmle/tests Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 1
- void testFunction (char c1 )
1
+ void testFunction (char c1 , int i1 )
2
2
{
3
3
4
-
5
4
switch (c1 ){ // GOOD
6
5
case 12 :
7
6
break ;
@@ -10,7 +9,14 @@ void testFunction(char c1)
10
9
case 9 :
11
10
break ;
12
11
}
13
-
12
+
13
+ switch (i1 ){ // GOOD
14
+ for (i1 = 0 ;i1 < 20 ;i1 ++ ){
15
+ case 12 :
16
+ case 10 :
17
+ case 9 :
18
+ }
19
+ }
14
20
switch (c1 ){ // BAD
15
21
case 12 :
16
22
break ;
@@ -20,7 +26,7 @@ void testFunction(char c1)
20
26
break ;
21
27
dafault :
22
28
}
23
-
29
+
24
30
switch (c1 ){ // BAD
25
31
c1 = c1 * 2 ;
26
32
case 12 :
@@ -31,10 +37,9 @@ void testFunction(char c1)
31
37
break ;
32
38
}
33
39
34
-
35
40
if ((c1 < 6 )&& (c1 > 0 ))
36
41
switch (c1 ){ // BAD
37
- case 7 :
42
+ case 8 :
38
43
break ;
39
44
case 5 :
40
45
break ;
@@ -43,7 +48,7 @@ void testFunction(char c1)
43
48
case 1 :
44
49
break ;
45
50
}
46
-
51
+
47
52
if ((c1 < 6 )&& (c1 > 0 ))
48
53
switch (c1 ){ // BAD
49
54
case 3 :
You can’t perform that action at this time.
0 commit comments