mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C#: Add test that illustrates problem with flow through phi nodes
This commit is contained in:
@@ -363,4 +363,22 @@ public class LocalDataFlow
|
||||
Span<object> span = args; // flow (library operator)
|
||||
LocalDataFlow x = args; // no flow (source code operator)
|
||||
}
|
||||
|
||||
void PhiFlow(bool b1, bool b2)
|
||||
{
|
||||
var x = "";
|
||||
|
||||
if (b1)
|
||||
{
|
||||
x = "tainted";
|
||||
if (b2)
|
||||
{
|
||||
Console.WriteLine(x);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
x = "not tainted";
|
||||
Check(x);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user