Add files via upload

This commit is contained in:
ihsinme
2021-06-15 16:43:57 +03:00
committed by GitHub
parent bdab785bef
commit 4f2703e0aa
3 changed files with 60 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
| test.c:14:3:22:3 | switch (...) ... | Possibly erroneous label name. |
| test.c:24:3:32:3 | switch (...) ... | Code before case will not be executed. |
| test.c:36:3:45:3 | switch (...) ... | The range of condition values is less than the selection. |
| test.c:48:3:53:3 | switch (...) ... | The range of condition values is wider than the choices. |

View File

@@ -0,0 +1 @@
experimental/Security/CWE/CWE-561/FindIncorrectlyUsedSwitch.ql

View File

@@ -0,0 +1,55 @@
void testFunction()
{
char c1;
switch(c1){ // GOOD
case 12:
break;
case 10:
break;
case 9:
break;
}
switch(c1){ // BAD
case 12:
break;
case 10:
break;
case 9:
break;
dafault:
}
switch(c1){ // BAD
c1=c1*2;
case 12:
break;
case 10:
break;
case 9:
break;
}
if((c1<6)&&(c1>0))
switch(c1){ // BAD
case 7:
break;
case 5:
break;
case 3:
break;
case 1:
break;
}
if((c1<6)&&(c1>0))
switch(c1){ // BAD
case 3:
break;
case 1:
break;
}
}