File: fuzz_read.py

package info (click to toggle)
python-imageio 2.37.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,684 kB
  • sloc: python: 26,302; makefile: 138
file content (28 lines) | stat: -rw-r--r-- 490 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
28
#!/usr/bin/python3
import os
import sys
import atheris  # type: ignore

import imageio


def TestOneInput(data):
    with open("/tmp/img1.file", "wb+") as img1_f:
        img1_f.write(data)
    try:
        imageio.imread("/tmp/img1.file")
    except ValueError:
        None
    except RuntimeError:
        None
    os.remove("/tmp/img1.file")


def main():
    atheris.instrument_all()
    atheris.Setup(sys.argv, TestOneInput)
    atheris.Fuzz()


if __name__ == "__main__":
    main()