Skip to content

Fix a crash when resizing to a non-finite size - #888

Merged
kean merged 1 commit into
fix/resize-crop-honors-upscalefrom
fix/resize-non-finite-size-crash
Aug 15, 2026
Merged

kean merged 1 commit into
fix/resize-crop-honors-upscalefrom
fix/resize-non-finite-size-crash

Conversation

@kean

@kean kean commented Aug 15, 2026 •

Copy link
Copy Markdown
Owner

CGContext.make converted the target size with Int(_:), which traps on a CGFloat that is NaN, infinite, or out of the Int range, so ImageProcessors.Resize(size: CGSize(width: .nan, height: .nan)) crashed the processing queue.

The dimensions are now validated before the conversion and the context creation returns nil, which the processors already treat as a failure. The resizing paths also reject non-finite target sizes up front so that cropping and non-cropping behave the same way instead of silently returning the original image.

Based on #886, which touches the same function. Merge that one first; the base will retarget to main automatically.

`Int(_:)` traps on a `CGFloat` that is NaN, infinite, or out of range, so
a target size coming from the user crashed the processing queue instead of
failing gracefully.
@kean
kean force-pushed the fix/resize-non-finite-size-crash branch from d156b7f to 1affc80 Compare August 15, 2026 14:51
@kean
kean changed the base branch from main to fix/resize-crop-honors-upscale August 15, 2026 14:51
@kean
kean merged commit 506d503 into fix/resize-crop-honors-upscale Aug 15, 2026
5 checks passed
@kean
kean deleted the fix/resize-non-finite-size-crash branch August 15, 2026 14:58
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