mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-03 11:35:52 +03:00
Improved documentation
This commit is contained in:
parent
56a43a5fa7
commit
265bfef36e
|
@ -52,11 +52,11 @@ Functions
|
|||
.. warning::
|
||||
To protect against potential DOS attacks caused by "`decompression bombs`_" (i.e. malicious files
|
||||
which decompress into a huge amount of data and are designed to crash or cause disruption by using up
|
||||
a lot of memory), Pillow will issue a ``DecompressionBombWarning`` if the image is over a certain
|
||||
limit. If desired, the warning can be turned into an error with
|
||||
``warnings.simplefilter('error', Image.DecompressionBombWarning)`` or suppressed entirely with
|
||||
``warnings.simplefilter('ignore', Image.DecompressionBombWarning)``. See also `the logging
|
||||
documentation`_ to have warnings output to the logging facility instead of stderr.
|
||||
a lot of memory), Pillow will issue a ``DecompressionBombWarning`` if the number of pixels in an
|
||||
image is over a certain limit, :py:data:`PIL.Image.MAX_IMAGE_PIXELS`. If desired, the warning can be
|
||||
turned into an error with ``warnings.simplefilter('error', Image.DecompressionBombWarning)`` or
|
||||
suppressed entirely with ``warnings.simplefilter('ignore', Image.DecompressionBombWarning)``. See
|
||||
also `the logging documentation`_ to have warnings output to the logging facility instead of stderr.
|
||||
|
||||
.. _decompression bombs: https://en.wikipedia.org/wiki/Zip_bomb
|
||||
.. _the logging documentation: https://docs.python.org/3/library/logging.html#integration-with-the-warnings-module
|
||||
|
|
|
@ -81,7 +81,7 @@ class DecompressionBombError(Exception):
|
|||
pass
|
||||
|
||||
|
||||
# Limit to around a quarter gigabyte for a 24 bit (3 bpp) image
|
||||
# Limit to around a quarter gigabyte for a 24-bit (3 bpp) image
|
||||
MAX_IMAGE_PIXELS = int(1024 * 1024 * 1024 // 4 // 3)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user