Skip to content

feat: add "limits:resolution" global attribute to cap per-dimension size#5297

Open
lgritz wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
lgritz:lg-limitsres
Open

feat: add "limits:resolution" global attribute to cap per-dimension size#5297
lgritz wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
lgritz:lg-limitsres

Conversation

@lgritz

@lgritz lgritz commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

The existing "limits:imagesize_MB" rejects files whose total uncompressed size exceeds a cap, but it cannot catch an image that is tiny in one dimension yet absurdly large in another (e.g. an image claiming 32 x 50331680, which slips under the 32 GB default). Add a companion global attribute, "limits:resolution", that caps the maximum number of pixels along any single dimension.

Like imagesize_MB, this is enforced only in ImageInput::check_open(), intended for validity checks when reading untrusted files.

Applications may set the attribute larger or smaller than this default, depending on their need to deal with images larger than these limits, and/or willingness to risk mistaking a corrupted or maliciously crafted image for a legitimate one on this basis.

Assisted-by: Claude Code / Claude Opus 4.8

The existing "limits:imagesize_MB" rejects files whose total
uncompressed size exceeds a cap, but it cannot catch an image that is
tiny in one dimension yet absurdly large in another (e.g. an image
claiming 32 x 50331680, which slips under the 32 GB default). Add a
companion global attribute, "limits:resolution", that caps the maximum
number of pixels along any single dimension.

Like imagesize_MB, this is enforced only in ImageInput::check_open(),
intended for validity checks when reading untrusted files.

Applications may set the attribute larger or smaller than this
default, depending on their need to deal with images larger than these
limits, and/or willingness to risk mistaking a corrupted or
maliciously crafted image for a legitimate one on this basis.

Assisted-by: Claude Code / Claude Opus 4.8

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant