Skip to content

fix: Reject sub-pixel resizes and wrap vips errors - #145

Merged
elektronaut merged 1 commit into
mainfrom
wrap-vips-error-in-resize
Sep 20, 2026
Merged

elektronaut merged 1 commit into
mainfrom
wrap-vips-error-in-resize

Conversation

@elektronaut

Copy link
Copy Markdown
Owner

Model::Transformations#resize scaled through vector2d's fit and handed the result straight to vips, with nothing equivalent to the guard ImageSizing#fit applies on the render path — so a result under a pixel reached thumbnail_image(0, height: 0), where "0x0" raised a raw Vips::Error and "1x1" against a 320x200 image silently produced a 1x1 file after vips clamped the zero height and logged GLib criticals. Both now raise InvalidSizeOptions, the same error the render path raises for the same size; the "1x1" case is the only behaviour change, and it lines the write path up with what ImageSizing#fit has rejected since #142.

transform_image also wraps Vips::Error in InvalidImage, matching ProcessedImage#normalized, so a vips failure on unreadable stored data surfaces as a DynamicImage error from rotate as well as resize.

Model::Transformations#resize scaled through vector2d's fit and handed
the result straight to vips, with nothing equivalent to the guard
ImageSizing#fit applies on the render path. A result under a pixel
reached thumbnail_image(0, height: 0), so "0x0" raised a raw Vips::Error
and "1x1" against a 320x200 image silently produced a 1x1 file after
vips clamped the zero height and logged GLib criticals. Both now raise
InvalidSizeOptions, the same error the render path raises for the same
size.

transform_image also wraps Vips::Error in InvalidImage, matching
ProcessedImage#normalized, so a vips failure on unreadable stored data
surfaces as a DynamicImage error from rotate as well as resize.
@elektronaut
elektronaut enabled auto-merge (squash) September 20, 2026 15:37
@elektronaut
elektronaut merged commit 0554e6a into main Sep 20, 2026
7 checks passed
@elektronaut
elektronaut deleted the wrap-vips-error-in-resize branch September 20, 2026 15:37
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