mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
C++: Identified another real-life FP
This commit is contained in:
@@ -13,6 +13,8 @@ struct X {
|
||||
|
||||
#define BAR(x, y) ((x), (y))
|
||||
|
||||
#define BAZ //printf
|
||||
|
||||
int test(int i, int j, int (*foo)(int), int (*bar)(int, int))
|
||||
{
|
||||
// Comma in simple if statement (prototypical example):
|
||||
@@ -82,6 +84,9 @@ int test(int i, int j, int (*foo)(int), int (*bar)(int, int))
|
||||
(void)sizeof(x.foo(i++), // GOOD? Unlikely to be misread
|
||||
j++);
|
||||
|
||||
BAZ("%d %d\n", i,
|
||||
j); // GOOD [FALSE POSITIVE] -- but can only be excluded by excluding all parenthesized commas (which sounds like a good idea actually)
|
||||
|
||||
// Comma in loops
|
||||
|
||||
while (i = foo(j++), // GOOD
|
||||
|
||||
Reference in New Issue
Block a user