Skip to content

fix: cap affinity bitmap and canvas pixel count - #30

Merged
IAmJSD merged 2 commits into
Infrawrench:mainfrom
ProdigyRahul:fix/affinity-bitmap-pixel-cap
Aug 25, 2026
Merged

fix: cap affinity bitmap and canvas pixel count#30
IAmJSD merged 2 commits into
Infrawrench:mainfrom
ProdigyRahul:fix/affinity-bitmap-pixel-cap

Conversation

@ProdigyRahul

Copy link
Copy Markdown
Contributor

fixes #29

add a shared check_pixel_count and call it from both the canvas and the bitmap path. the ceiling is 2^28 pixels, a 16384x16384 image, which bounds the rgba buffer at 1 GiB.

capping area rather than either side keeps legitimate shapes working: a 1048576x16 strip still imports.

the multiply saturates, so an overflowing pair cannot wrap into a small number and slip through.

before

before

after

after

ProdigyRahul and others added 2 commits August 25, 2026 04:04
check_pixel_count was only tested directly, so dropping a call site
in build or decode_bitmap would leave the suite green. Parse a real
probe fixture, inflate its declared canvas and bitmap sizes past the
cap, and watch both paths refuse.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@IAmJSD IAmJSD left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cap is enforced on both the canvas and bitmap paths, and the new fixture-based test exercises it through the real import path.

@IAmJSD
IAmJSD merged commit d4b06f3 into Infrawrench:main Aug 25, 2026
3 checks passed
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.

affinity bitmap dimensions are capped individually but not as a product

2 participants