thumbnail: Factor frames into account for IMAGE_BOMB_TOTAL_PIXELS.

This commit is contained in:
Alex Vandiver
2024-07-19 18:19:28 +00:00
committed by Tim Abbott
parent aacf28f7e3
commit 71406ac767
2 changed files with 35 additions and 1 deletions

View File

@@ -163,7 +163,10 @@ def libvips_check_image(image_data: bytes) -> Iterator[pyvips.Image]:
except pyvips.Error:
raise BadImageError(_("Could not decode image; did you upload an image file?"))
if source_image.width * source_image.height > IMAGE_BOMB_TOTAL_PIXELS:
if (
source_image.width * source_image.height * source_image.get_n_pages()
> IMAGE_BOMB_TOTAL_PIXELS
):
raise BadImageError(_("Image size exceeds limit."))
try: