mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-31 11:13:08 +03:00
uglify
This commit is contained in:
parent
ffbaa6523d
commit
37a7c601cc
|
@ -14,32 +14,36 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import atheris_no_libfuzzer as atheris
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import io
|
import io
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
import atheris_no_libfuzzer as atheris
|
||||||
|
|
||||||
from PIL import Image, ImageFile, ImageFilter
|
from PIL import Image, ImageFile, ImageFilter
|
||||||
|
|
||||||
|
|
||||||
def TestOneInput(data):
|
def TestOneInput(data):
|
||||||
try:
|
try:
|
||||||
with Image.open(io.BytesIO(data)) as im:
|
with Image.open(io.BytesIO(data)) as im:
|
||||||
im.rotate(45)
|
im.rotate(45)
|
||||||
im.filter(ImageFilter.DETAIL)
|
im.filter(ImageFilter.DETAIL)
|
||||||
im.save(io.BytesIO(), "BMP")
|
im.save(io.BytesIO(), "BMP")
|
||||||
except Exception:
|
except Exception:
|
||||||
# We're catching all exceptions because Pillow's exceptions are
|
# We're catching all exceptions because Pillow's exceptions are
|
||||||
# directly inheriting from Exception.
|
# directly inheriting from Exception.
|
||||||
return
|
return
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
ImageFile.LOAD_TRUNCATED_IMAGES = True
|
ImageFile.LOAD_TRUNCATED_IMAGES = True
|
||||||
warnings.filterwarnings("ignore")
|
warnings.filterwarnings("ignore")
|
||||||
warnings.simplefilter('error', Image.DecompressionBombWarning)
|
warnings.simplefilter("error", Image.DecompressionBombWarning)
|
||||||
atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True)
|
atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True)
|
||||||
atheris.Fuzz()
|
atheris.Fuzz()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -840,7 +840,9 @@ class pil_build_ext(build_ext):
|
||||||
|
|
||||||
|
|
||||||
def debug_build():
|
def debug_build():
|
||||||
return hasattr(sys, "gettotalrefcount") or os.environ.get("LIB_FUZZING_ENGINE", None)
|
return hasattr(sys, "gettotalrefcount") or os.environ.get(
|
||||||
|
"LIB_FUZZING_ENGINE", None
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
files = ["src/_imaging.c"]
|
files = ["src/_imaging.c"]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user