"zip bombs" are a somewhat know threat, but it also applies to images and can't be protected against by checking the filesystem size of the data:
This means it's possible to DOS e.g. a web application performing image resizing by sending one of these bombs. As far as I can tell the protection possibilities are limited:
- assert source image sizes before doing any operation which will need the image data, the documentation may benefit from a warning on that subject (similar to warnings about XML vulnerabilities in the Python documentation),
Image.open could be augmented with e.g. a maximum_pixels parameter raising an error in case image.h * image.w goes above the specified limit to make this easier for users
- during image loading/decompression, raise an error if the decompressed data size gets above a specific threshold
"zip bombs" are a somewhat know threat, but it also applies to images and can't be protected against by checking the filesystem size of the data:
This means it's possible to DOS e.g. a web application performing image resizing by sending one of these bombs. As far as I can tell the protection possibilities are limited:
Image.opencould be augmented with e.g. amaximum_pixelsparameter raising an error in caseimage.h * image.wgoes above the specified limit to make this easier for users