🕸️Control Flow Graph (CFG)
Also known as CFG, Flow Graph
A map of each path a function can take. It splits at each if and loop.
Think of it like
It is like a maze map. It shows each path you could walk, and where the paths split.
Example
A tool reads the control flow graph of a login function. It finds one path where the password check is skipped.
Why it matters
Bugs hide on paths nobody tested. The graph shows every one of them.
Definition
Common mistake
Key takeaways
- 1Boxes of steps. No choices inside a box.
- 2Splits at choices. Each if or loop branches.
- 3Every path. Even the ones you never run.