Skip to content

Instantly share code, notes, and snippets.

@DRMacIver
Created October 24, 2015 16:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DRMacIver/bef6436b4c407febb358 to your computer and use it in GitHub Desktop.
Save DRMacIver/bef6436b4c407febb358 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import afl
from pywatchman import pybser
afl.start()
try:
pybser.loads(sys.stdin.read())
except BaseException as e:
if type(e) != RuntimeError:
raise
@DRMacIver
Copy link
Author

Here is the corpus of examples running this for a couple minutes produced:

'\x00\x01'
'\x00\x01\x05'
'\x00\x01\x06'
'\x00\x01\x04'
'\x00\x01\x03'
'\x00\x01\x04\x01\x00\x00'
'\x00\x01\x04\x01\x00\x01'
'\x00\x01\x04\x01\x00\x02'
'\x00\x01\x04\x01\x00\x04'
'\x00\x01\x03\x00'

Example error coming from this:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "pywatchman/pybser.py", line 293, in loads
    return _bser_loads_recursive(buf, pos)[0]
  File "pywatchman/pybser.py", line 269, in _bser_loads_recursive
    return _bunser_string(buf, pos)
  File "pywatchman/pybser.py", line 211, in _bunser_string
    str_len, pos = _bunser_int(buf, pos + 1)
  File "pywatchman/pybser.py", line 191, in _bunser_int
    int_type = buf[pos]
IndexError: string index out of range

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment