mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Fixing typo.
Restricting to analyze only logical & and | operations
This commit is contained in:
@@ -13,6 +13,14 @@ void C6317_negative(int i)
|
||||
if (i & ~FLAGS)
|
||||
{
|
||||
}
|
||||
|
||||
if (i && ~FLAGS)
|
||||
{
|
||||
}
|
||||
|
||||
if (i && !FLAGS)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void bitwiseAndUsage(unsigned int l, unsigned int r)
|
||||
@@ -48,33 +56,13 @@ void bitwiseOrUsage(unsigned int l, unsigned int r)
|
||||
x = !FLAGS || !!r; // Not a bug - logical or
|
||||
}
|
||||
|
||||
void bitwiseXorUsage(unsigned int l, unsigned int r)
|
||||
void bitwiseOperatorsNotCovered(unsigned int l, unsigned int r)
|
||||
{
|
||||
unsigned int x;
|
||||
|
||||
x = l ^ !r; //BUG
|
||||
x = !FLAGS ^ r; //BUG
|
||||
x = !FLAGS ^ !!r; //BUG
|
||||
|
||||
x = !!l ^ r; // Not a bug - double negation
|
||||
x = !!!l ^ r; // Not a bug - double negation
|
||||
x = !!FLAGS ^ r; // Not a bug - double negation
|
||||
}
|
||||
|
||||
void shoftUsage(unsigned int val)
|
||||
{
|
||||
unsigned int x;
|
||||
|
||||
x = !val << 1; //BUG
|
||||
x = !val >> 1; //BUG
|
||||
|
||||
x = !!val << 2; // Not a bug - double negation
|
||||
x = !!val >> 2; // Not a bug - double negation
|
||||
}
|
||||
|
||||
unsigned int bitWiseShiftUsage(unsigned int val)
|
||||
{
|
||||
return ((unsigned int)(!!val) << 4) + ((unsigned int)(!!val) >> 1); // Not a bug (double negation)
|
||||
x = l ^ !r;
|
||||
x = !l << 1;
|
||||
x = !l >> 1;
|
||||
}
|
||||
|
||||
void macroUsage(unsigned int arg1, unsigned int arg2)
|
||||
|
||||
@@ -13,6 +13,14 @@ void C6317_negative(int i)
|
||||
if (i & ~FLAGS)
|
||||
{
|
||||
}
|
||||
|
||||
if (i && ~FLAGS)
|
||||
{
|
||||
}
|
||||
|
||||
if (i && !FLAGS)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void bitwiseAndUsage(unsigned int l, unsigned int r)
|
||||
@@ -48,33 +56,13 @@ void bitwiseOrUsage(unsigned int l, unsigned int r)
|
||||
x = !FLAGS || !!r; // Not a bug - logical or
|
||||
}
|
||||
|
||||
void bitwiseXorUsage(unsigned int l, unsigned int r)
|
||||
void bitwiseOperatorsNotCovered(unsigned int l, unsigned int r)
|
||||
{
|
||||
unsigned int x;
|
||||
|
||||
x = l ^ !r; //BUG
|
||||
x = !FLAGS ^ r; //BUG
|
||||
x = !FLAGS ^ !!r; //BUG
|
||||
|
||||
x = !!l ^ r; // Not a bug - double negation
|
||||
x = !!!l ^ r; // Not a bug - double negation
|
||||
x = !!FLAGS ^ r; // Not a bug - double negation
|
||||
}
|
||||
|
||||
void shoftUsage(unsigned int val)
|
||||
{
|
||||
unsigned int x;
|
||||
|
||||
x = !val << 1; //BUG
|
||||
x = !val >> 1; //BUG
|
||||
|
||||
x = !!val << 2; // Not a bug - double negation
|
||||
x = !!val >> 2; // Not a bug - double negation
|
||||
}
|
||||
|
||||
unsigned int bitWiseShiftUsage(unsigned int val)
|
||||
{
|
||||
return ((unsigned int)(!!val) << 4) + ((unsigned int)(!!val) >> 1); // Not a bug (double negation)
|
||||
x = l ^ !r;
|
||||
x = !l << 1;
|
||||
x = !l >> 1;
|
||||
}
|
||||
|
||||
void macroUsage(unsigned int arg1, unsigned int arg2)
|
||||
|
||||
@@ -1,26 +1,16 @@
|
||||
| IncorrectNotOperatorUsage.c:6:9:6:18 | ... & ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:23:9:23:14 | ... & ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:24:9:24:18 | ... & ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:25:9:25:20 | ... & ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:39:9:39:14 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:40:9:40:18 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:41:9:41:20 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:55:9:55:14 | ... ^ ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:56:9:56:18 | ... ^ ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:57:9:57:20 | ... ^ ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:68:9:68:17 | ... << ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:69:9:69:17 | ... >> ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:82:10:82:34 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:31:9:31:14 | ... & ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:32:9:32:18 | ... & ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:33:9:33:20 | ... & ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:47:9:47:14 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:48:9:48:18 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:49:9:49:20 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.c:70:10:70:34 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:6:9:6:18 | ... & ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:23:9:23:14 | ... & ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:24:9:24:18 | ... & ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:25:9:25:20 | ... & ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:39:9:39:14 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:40:9:40:18 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:41:9:41:20 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:55:9:55:14 | ... ^ ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:56:9:56:18 | ... ^ ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:57:9:57:20 | ... ^ ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:68:9:68:17 | ... << ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:69:9:69:17 | ... >> ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:82:10:82:34 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:31:9:31:14 | ... & ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:32:9:32:18 | ... & ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:33:9:33:20 | ... & ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:47:9:47:14 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:48:9:48:18 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:49:9:49:20 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:70:10:70:34 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
|
||||
Reference in New Issue
Block a user