tree-sitter / afl-tree-sitter

AFL test harness for tree-sitter runtime and parsers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

afl-tree-sitter

afl fuzzing for tree-sitter.

Overview

This project focuses on fuzzing the tree-sitter runtime and associated parsers for each language tree-sitter supports. It does this through a small set of test harnesses, which are C programs—one for each language—that take an input file and (try to) parse it. The test harness, tree-sitter, and the language parsers are all compiled with afl-clang and hardening, after which fuzzing is performed with afl-fuzz.

Getting started

script/bootstrap
script/setup-ramdisk # Optional, but recommended b/c afl is hard on SSDs.
cd /Volumes/ramdisk/
./fuzz javascript

Bugs found so far

An incomplete list of interesting bugs found using afl-fuzz.

tree-sitter runtime

tree-sitter-ruby

Run parallel

You can fuzz in parallel to take full advantage of multi-core systems. See script/fuzz for specific options passed to afl-fuzz and for language setup.

# Fuzz in parallel with 1 primary and 3 secondary fuzzers.
./fuzz -p -n 3 javascript

About

AFL test harness for tree-sitter runtime and parsers


Languages

Language:C 39.3%Language:Shell 36.1%Language:Makefile 23.0%Language:Ruby 0.7%Language:Go 0.7%Language:JavaScript 0.3%