mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Tidy docs for DecompressionBombWarning
* Fix formatting to display simplefilter examples as code blocks rather than italics * Wrap text so it's not one incredibly long line
This commit is contained in:
		
							parent
							
								
									43830273a5
								
							
						
					
					
						commit
						5ec6fcdeaa
					
				| 
						 | 
					@ -49,7 +49,14 @@ Functions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. autofunction:: open
 | 
					.. autofunction:: open
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    .. 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.
 | 
					    .. 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.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.. _decompression bombs: https://en.wikipedia.org/wiki/Zip_bomb
 | 
						.. _decompression bombs: https://en.wikipedia.org/wiki/Zip_bomb
 | 
				
			||||||
	.. _the logging documentation: https://docs.python.org/2/library/logging.html?highlight=logging#integration-with-the-warnings-module
 | 
						.. _the logging documentation: https://docs.python.org/2/library/logging.html?highlight=logging#integration-with-the-warnings-module
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user