Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cupsfilters/image-png.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ _cfImageReadPNG(
img->colorspace = secondary;

if (width == 0 || width > CF_IMAGE_MAX_WIDTH ||
height == 0 || height > CF_IMAGE_MAX_HEIGHT)
height == 0 || height > CF_IMAGE_MAX_HEIGHT ||
width > CF_IMAGE_MAX_PIXELS || height > CF_IMAGE_MAX_PIXELS)
{
DEBUG_printf(("DEBUG: PNG image has invalid dimensions %ux%u!\n",
(unsigned)width, (unsigned)height));
Expand Down
8 changes: 8 additions & 0 deletions cupsfilters/image-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@
# define CF_IMAGE_MAX_HEIGHT 0x3fffffff
// 2^30-1

# define CF_IMAGE_MAX_PIXELS 283465
// Max pixels per side: 5 m at 1440 dpi,
// the largest realistic print (5 m-wide
// inkjets exist). Bounding each dimension
// keeps the decoded buffer-size
// multiplication from overflowing;
// allocations too large for the machine
// then fail gracefully at malloc().
# define CF_TILE_SIZE 256 // 256x256 pixel tiles
# define CF_TILE_MINIMUM 10 // Minimum number of tiles

Expand Down
Loading