mirror of
https://github.com/github/codeql.git
synced 2026-04-26 09:15:12 +02:00
C#: Add test showing false positive
This commit is contained in:
@@ -20,6 +20,8 @@ class Test
|
||||
var b = true;
|
||||
b &= c.Method(); // GOOD
|
||||
b |= c[0]; // GOOD
|
||||
|
||||
if (c == null | c.Method(out _)) ; // GOOD (false positive)
|
||||
}
|
||||
|
||||
class C
|
||||
@@ -28,6 +30,7 @@ class Test
|
||||
public string Property { get; set; }
|
||||
public bool this[int i] { get { return false; } set { } }
|
||||
public bool Method() { return false; }
|
||||
public bool Method(out int x) { x = 0; return false; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
| DangerousNonShortCircuitLogic.cs:16:13:16:40 | ... \| ... | Potentially dangerous use of non-short circuit logic. |
|
||||
| DangerousNonShortCircuitLogic.cs:17:13:17:28 | ... \| ... | Potentially dangerous use of non-short circuit logic. |
|
||||
| DangerousNonShortCircuitLogic.cs:18:13:18:34 | ... \| ... | Potentially dangerous use of non-short circuit logic. |
|
||||
| DangerousNonShortCircuitLogic.cs:24:13:24:39 | ... \| ... | Potentially dangerous use of non-short circuit logic. |
|
||||
|
||||
Reference in New Issue
Block a user