Pillow/Tests
Eric Soroos 756fff3312 Fix Memory DOS in Icns, Ico and Blp Image Plugins
Some container plugins that could contain images of other formats,
such as the ICNS format, did not properly check the reported size of
the contained image. These images could cause arbitrariliy large
memory allocations.

This is fixed for all locations where individual *ImageFile classes
are created without going through the usual Image.open method.
2021-03-06 13:37:58 +11:00
..
fonts Document FreeMono license [ci skip] 2020-10-23 21:08:06 +11:00
icc Corrected filename [ci skip] 2016-05-03 19:23:51 +10:00
images Fix Memory DOS in Icns, Ico and Blp Image Plugins 2021-03-06 13:37:58 +11:00
__init__.py Improve pytest configuration to allow specific tests as CLI args 2019-01-13 09:00:12 -08:00
32bit_segfault_check.py Introduce isort to automate import ordering and formatting 2019-07-06 16:11:35 -07:00
bench_cffi_access.py Remove old Travis CI config 2020-12-19 21:57:32 +02:00
check_fli_oob.py Format with Black 2020-04-01 09:54:26 +03:00
check_fli_overflow.py Removed PillowTestCase helper class 2020-03-28 12:51:28 +11:00
check_icns_dos.py Use bytes literals instead of bytes(str) 2019-10-06 19:26:55 -07:00
check_imaging_leaks.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
check_j2k_dos.py Use bytes literals instead of bytes(str) 2019-10-06 19:26:55 -07:00
check_j2k_leaks.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
check_j2k_overflow.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
check_jp2_overflow.py Format with Black 2020-04-01 10:34:19 +03:00
check_jpeg_leaks.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
check_large_memory_numpy.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
check_large_memory.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
check_libtiff_segfault.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
check_png_dos.py Upgrade Python syntax for 3.6+ 2020-07-30 10:09:18 +03:00
conftest.py Upgrade Python syntax for 3.6+ 2020-07-30 10:09:18 +03:00
createfontdatachunk.py Upgrade Python syntax for 3.6+ 2020-07-30 10:09:18 +03:00
helper.py Travis CI is no longer used 2020-12-19 21:57:32 +02:00
README.rst unittest is no longer used in every test [ci skip] 2020-03-27 18:36:36 +11:00
test_000_sanity.py Convert some tests to pytest style 2020-01-18 12:12:10 -08:00
test_binary.py Convert some tests to pytest style 2020-01-18 12:12:10 -08:00
test_bmp_reference.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_box_blur.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_color_lut.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_core_resources.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_decompression_bomb.py Corrected argument 2020-12-31 16:25:46 +11:00
test_features.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_apng.py Use disposal settings from previous frame 2020-12-24 09:55:22 +11:00
test_file_blp.py Converted to pytest 2020-02-25 20:57:27 +11:00
test_file_bmp.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_bufrstub.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_container.py Return strings or bytes from ContainerIO according to the file object mode 2020-02-15 22:13:10 +11:00
test_file_cur.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_dcx.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_dds.py Merge pull request #4760 from qiankanglai/dds-rgba8888 2020-10-15 08:10:01 +03:00
test_file_eps.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_fitsstub.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_fli.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_fpx.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_ftex.py Converted to pytest 2020-02-25 20:57:27 +11:00
test_file_gbr.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_gd.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_gif.py Merge pull request #5149 from wiredfool/gif_write_oob_read 2021-01-02 10:14:17 +02:00
test_file_gimpgradient.py Move safe imports to the top of test files 2020-02-17 10:49:27 -08:00
test_file_gimppalette.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_gribstub.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_hdf5stub.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_icns.py Fix Memory DOS in Icns, Ico and Blp Image Plugins 2021-03-06 13:37:58 +11:00
test_file_ico.py Merge pull request #4568 from ziplantil/ico-append-images 2020-12-24 11:10:33 +11:00
test_file_im.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_iptc.py Convert various tests to pytest style 2020-01-27 22:46:52 +11:00
test_file_jpeg.py fixup! Add tests for loading/saving of 16-bit quantization tables 2020-10-10 20:01:28 +02:00
test_file_jpeg2k.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_libtiff_small.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_libtiff.py xfail failing libtiff tests on big-endian 2020-12-12 15:26:42 +01:00
test_file_mcidas.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_mic.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_mpo.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_msp.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_palm.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_pcd.py Converted to pytest 2020-02-25 20:57:27 +11:00
test_file_pcx.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_pdf.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_pixar.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_png.py Added exception explaining that _repr_png_ saves to PNG 2020-12-27 15:36:16 +11:00
test_file_ppm.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_psd.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_sgi.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_spider.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_sun.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_tar.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_tga.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_tiff_metadata.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_tiff.py Block TIFFTAG_SUBIFD 2020-12-22 11:38:02 +11:00
test_file_wal.py Convert some tests to pytest style 2020-01-18 12:12:10 -08:00
test_file_webp_alpha.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_webp_animated.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_webp_lossless.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_webp_metadata.py Corrected reading EXIF metadata without prefix 2020-06-07 20:01:04 +10:00
test_file_webp.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_wmf.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_xbm.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_xpm.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_file_xvthumb.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_font_bdf.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_font_leaks.py Streamline test skipping based on supported features 2020-02-18 13:07:01 -08:00
test_font_pcf_charsets.py Upgrade Python syntax for 3.6+ 2020-07-30 10:09:18 +03:00
test_font_pcf.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_format_hsv.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_format_lab.py Convert some tests to pytest style 2020-01-18 12:12:10 -08:00
test_image_access.py Updated test 2020-09-22 13:06:52 +10:00
test_image_array.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_image_convert.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_image_copy.py Convert various tests to pytest style 2020-01-27 22:46:52 +11:00
test_image_crop.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_image_draft.py Streamline test skipping based on supported features 2020-02-18 13:07:01 -08:00
test_image_entropy.py Replace unittest with pytest 2020-02-13 12:15:05 +02:00
test_image_filter.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_image_frombytes.py Remove im.offset, deprecated in 2001; and fromstring and tostring, deprecated in 2013 2020-07-17 10:55:20 +03:00
test_image_fromqimage.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_image_getbands.py Convert some tests to pytest style 2020-01-18 12:12:10 -08:00
test_image_getbbox.py If an alpha channel is present, only use that to get bounding box 2020-02-28 22:33:02 +11:00
test_image_getcolors.py Convert various tests to pytest style 2020-01-27 22:46:52 +11:00
test_image_getdata.py Convert various tests to pytest style 2020-01-27 22:46:52 +11:00
test_image_getextrema.py Fixed endian handling for I;16 getextrema 2020-02-29 20:29:28 +11:00
test_image_getim.py Convert some tests to pytest style 2020-01-18 12:12:10 -08:00
test_image_getpalette.py Convert some tests to pytest style 2020-01-18 12:12:10 -08:00
test_image_getprojection.py Convert various tests to pytest style 2020-01-27 22:46:52 +11:00
test_image_histogram.py Convert various tests to pytest style 2020-01-27 22:46:52 +11:00
test_image_load.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_image_mode.py Move safe imports to the top of test files 2020-02-17 10:49:27 -08:00
test_image_paste.py Consider transparency when drawing text on an RGBA image 2020-04-19 20:56:17 +10:00
test_image_point.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_image_putalpha.py Convert various tests to pytest style 2020-01-27 22:46:52 +11:00
test_image_putdata.py Replace unittest with pytest 2020-02-13 12:15:05 +02:00
test_image_putpalette.py Allow putpalette to accept 1024 integers to include alpha values 2020-12-12 14:12:30 +11:00
test_image_quantize.py xfail tests failing on ppc64le on GHA 2020-12-12 15:26:42 +01:00
test_image_reduce.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_image_resample.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_image_resize.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_image_rotate.py Replace unittest with pytest 2020-02-13 12:15:05 +02:00
test_image_split.py Converted to pytest 2020-02-25 20:57:27 +11:00
test_image_thumbnail.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_image_tobitmap.py Replace unittest with pytest 2020-02-13 12:15:05 +02:00
test_image_tobytes.py Convert some tests to pytest style 2020-01-18 12:12:10 -08:00
test_image_transform.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_image_transpose.py Replace unittest with pytest 2020-02-13 12:15:05 +02:00
test_image.py Lint fix 2021-01-02 20:41:17 +11:00
test_imagechops.py Added more tests 2020-06-29 23:31:04 +03:00
test_imagecms.py compatibility for LCMS<2.7, vix LCMS version string 2020-10-12 02:58:24 +01:00
test_imagecolor.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_imagedraw.py Merge pull request #4523 from xtsm/ellipse 2020-10-11 18:04:34 +03:00
test_imagedraw2.py Merge pull request #4523 from xtsm/ellipse 2020-10-11 18:04:34 +03:00
test_imageenhance.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_imagefile.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_imagefont.py Merge pull request #5098 from hugovk/deprecate-freetype 2020-12-20 13:35:41 +11:00
test_imagefontctl.py Merge pull request #4971 from radarhere/freetype 2020-10-13 06:10:01 +00:00
test_imagegrab.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_imagemath.py Upgrade Python syntax for 3.6+ 2020-07-30 10:09:18 +03:00
test_imagemorph.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_imageops_usm.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_imageops.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_imagepalette.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_imagepath.py Add tests for ImagePath.Path 2020-12-18 22:54:48 +02:00
test_imageqt.py Add support for PySide6 2021-01-01 20:34:44 +02:00
test_imagesequence.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_imageshow.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_imagestat.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_imagetk.py Revert "Skip due to segmentation fault" 2020-10-04 22:48:23 +01:00
test_imagewin_pointers.py Convert various tests to pytest style 2020-01-27 22:46:52 +11:00
test_imagewin.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_lib_image.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_lib_pack.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_locale.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_main.py Convert some tests to pytest style 2020-01-18 12:12:10 -08:00
test_map.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_mode_i16.py Upgrade Python syntax for 3.6+ 2020-07-30 10:09:18 +03:00
test_numpy.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_pdfparser.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_pickle.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_psdraw.py Convert various tests to pytest style 2020-01-27 22:46:52 +11:00
test_pyroma.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_qt_image_qapplication.py Refactor 2021-01-01 20:37:16 +02:00
test_qt_image_toqimage.py Moved QApplication into one test 2021-01-01 11:33:20 +11:00
test_sgi_crash.py Fix OOB read in SgiRleDecode.c 2021-03-01 19:08:26 +11:00
test_shell_injection.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_tiff_crashes.py Fix for CVE-2021-25291 2021-03-01 19:08:52 +11:00
test_tiff_ifdrational.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_uploader.py Converted to pytest 2020-02-25 20:57:27 +11:00
test_util.py Merge branch 'master' into rm-3.5 2020-09-01 20:16:46 +03:00
test_webp_leaks.py Streamline test skipping based on supported features 2020-02-18 13:07:01 -08:00

Pillow Tests
============

Test scripts are named ``test_xxx.py``. Helper classes and functions can be found in ``helper.py``.

Dependencies
------------

Install::

    python3 -m pip install pytest pytest-cov

Execution
---------

To run an individual test::

    pytest Tests/test_image.py

Or::

    pytest -k test_image.py

Run all the tests from the root of the Pillow source distribution::

    pytest

Or with coverage::

    pytest --cov PIL --cov Tests --cov-report term
    coverage html
    open htmlcov/index.html