~/talk

Let's Build a Symbolic Analyser And Automatically Find Bugs

Talkat PyCon AU 2019 · 2019-08-02..08-06· [testing, security]
links:none on file
slides:none on file

Shows how to build a Python symbolic analyser using Z3 to prove reachability, generate concrete inputs for each satisfiable path, and automatically find unreachable code. It disassembles CPython bytecode, builds a bytecode control-flow graph, enumerates basic-block paths, encodes SSA-style variable versions and path constraints, and queries Z3 for satisfiable vs unsatisfiable paths. Demonstrations include deriving a concrete number of pies that meets constraints and explaining limits like path explosion and aliasing.

AI-written summary · about

  1. 0:00Start
  2. 3:18WHAT'S STATIC ANALYSIS
  3. 3:59WHAT'S SYMBOLIC EXECUTION
  4. 4:17PROVE THAT THE LAST LINE CAN RUN, WITHOUT RUNNING THE CODE
  5. 6:19THE Z3 THEOREM PROVER
  6. 6:57WHAT CAN YOU DO WITH Z3?
  7. 11:04THE CODE REACHABILITY PROBLEM
  8. 11:42HOW DO WE PROVE THE BUG?
  9. 12:29CODE GRAPH ANALYSIS
  10. 13:05PYTHON BYTECODE
  11. 15:15FINDING THE BASIC BLOCKS
  12. 15:51HOW TO FIND A BASIC BLOCK
  13. 17:18CONNECTING THE BASIC BLOCKS
  14. 21:30FIGURING IT OUT, STEP BY STEP
  15. 21:40FAKE VARIABLES
  16. 22:16ASIDE: VALUES NEVER DIE
  17. 23:23SINGLE STATIC ASSIGNMENT
  18. 24:03SETTING VARIABLES
  19. 24:33CONDITIONAL JUMPS
  20. 24:58OPERATIONS
  21. 25:20DETECTING IMPOSSIBLE PATHS
  22. 25:43GENERATING INPUT FOR CODE COVERAGE TESTS
  23. 26:38ADD INVARIANTS TO YOUR CODE
  24. 28:11FURTHER READING
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.