2020-03-28 16:19:27 +03:00
|
|
|
#!/usr/bin/env python
|
2020-04-01 10:19:15 +03:00
|
|
|
import pytest
|
2020-08-07 13:28:33 +03:00
|
|
|
|
2020-03-28 16:19:27 +03:00
|
|
|
from PIL import Image
|
|
|
|
|
2020-04-01 10:13:12 +03:00
|
|
|
|
2020-04-01 10:19:15 +03:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
"test_file",
|
2020-10-30 02:07:15 +03:00
|
|
|
[
|
|
|
|
"Tests/images/sgi_overrun_expandrowF04.bin",
|
|
|
|
"Tests/images/sgi_crash.bin",
|
|
|
|
"Tests/images/crash-6b7f2244da6d0ae297ee0754a424213444e92778.sgi",
|
|
|
|
"Tests/images/ossfuzz-5730089102868480.sgi",
|
|
|
|
],
|
2020-04-01 10:13:12 +03:00
|
|
|
)
|
2020-04-01 10:19:15 +03:00
|
|
|
def test_crashes(test_file):
|
|
|
|
with open(test_file, "rb") as f:
|
|
|
|
im = Image.open(f)
|
2020-04-07 09:58:21 +03:00
|
|
|
with pytest.raises(OSError):
|
2020-04-01 10:19:15 +03:00
|
|
|
im.load()
|