Skip to content

Commit

Permalink
feat: add simple fuzz testing for parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
cktii committed May 14, 2024
1 parent a385863 commit 518666e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
Empty file added src/fuzz-testing/__init__.py
Empty file.
18 changes: 18 additions & 0 deletions src/fuzz-testing/nmea_fuzzer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
try:
import atheris
except ImportError:
raise ImportError("You need to install atheris to run this script.")
import sys

with atheris.instrument_imports():
from ..ntrip_client.nmea_parser import NMEAParser


def TestOneInput(data):
parser = NMEAParser()
parser.is_valid_sentence(data)


atheris.Setup(sys.argv, TestOneInput)
atheris.Fuzz()

18 changes: 18 additions & 0 deletions src/fuzz-testing/rtcm_fuzzer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
try:
import atheris
except ImportError:
raise ImportError("You need to install atheris to run this script.")
import sys

with atheris.instrument_imports():
from ..ntrip_client.rtcm_parser import RTCMParser


def TestOneInput(data):
parser = RTCMParser()
parser.parse(data)


atheris.Setup(sys.argv, TestOneInput)
atheris.Fuzz()

0 comments on commit 518666e

Please # to comment.