Skip to content

Prevent recursion crash on NaN image data - #2045

Merged
psavery merged 1 commit into
masterfrom
fix-nan-colormap-recursion
Aug 14, 2026
Merged

Prevent recursion crash on NaN image data#2045
psavery merged 1 commit into
masterfrom
fix-nan-colormap-recursion

Conversation

@psavery

@psavery psavery commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Images that are fully NaN (e.g. dark subtraction with a NaN dark file) made the color map bounds NaN, and NaN spin box values recurse infinitely since NaN != NaN re-emits valueChanged on every clamp. Guard the spin boxes, fall back to a finite range, and keep one bad detector from turning the global scaling minimum into NaN.

Images that are fully NaN (e.g. dark subtraction with a NaN dark
file) made the color map bounds NaN, and NaN spin box values recurse
infinitely since NaN != NaN re-emits valueChanged on every clamp.
Guard the spin boxes, fall back to a finite range, and keep one bad
detector from turning the global scaling minimum into NaN.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
@psavery
psavery force-pushed the fix-nan-colormap-recursion branch from b70e69c to 19c3ffd Compare July 8, 2026 04:49
@psavery
psavery requested a review from saransh13 August 14, 2026 19:38

@saransh13 saransh13 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.

I've lost the stack trace and the recipe to reproduce this so unable to test this. I'm sure that the np.nan and np.inf checks won't break anything so approving

@psavery
psavery merged commit 55b79e0 into master Aug 14, 2026
11 of 17 checks passed
@psavery
psavery deleted the fix-nan-colormap-recursion branch August 14, 2026 20:56
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.

2 participants