Skip to content

Input fuzzing action for tree-sitter parsers

License

Notifications You must be signed in to change notification settings

tree-sitter/fuzz-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tree-sitter parser fuzzing

Important

This only works on Linux.

Options

directory:
  description: The directory of the grammar
corpus:
  description: The directory of the seed corpus
timeout:
  description: The time to wait if the fuzzer hangs
  default: 10
max-time:
  description: The maximum total fuzzing time
  default: 60
max-length:
  description: The maximum fuzz input length
  default: 4096
tree-sitter-version:
  description: The tree-sitter version to install
  default: latest

Example configuration

name: Fuzz parser

on:
  push:
    branches: [master]
    paths:
      - src/scanner.c
  pull_request:
    paths:
      - src/scanner.c

jobs:
  test:
    name: Parser fuzzing
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: tree-sitter/fuzz-action@v4

Using locally

Requirements

  • pkg-config
  • make
  • jq
  • llvm
  • tree-sitter library

Usage

make LANG_NAME=parser LANG_DIR=/path/to/tree-sitter-parser

Tip

Check the Makefile for more options.

Credits

Based on vigoux/tree-sitter-fuzz-action