File: fuzz_sniffer.py

package info (click to toggle)
python-clevercsv 0.7.5%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 872 kB
  • sloc: python: 5,076; ansic: 763; makefile: 81
file content (27 lines) | stat: -rw-r--r-- 459 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -*- coding: utf-8 -*-

"""
Script to run PythonFuzz to detect unhandled exceptions in the Sniffer

This file is part of CleverCSV.

"""

from pythonfuzz.main import PythonFuzz

import clevercsv


@PythonFuzz
def fuzz(buf):
    try:
        string = buf.decode("utf-8")
        dialect = clevercsv.Sniffer().sniff(string)
    except UnicodeDecodeError:
        pass
    except clevercsv.exceptions.Error:
        pass


if __name__ == "__main__":
    fuzz()