Guard Relate geometry graph construction against NaN coordinates - #1556
Open
LucaCappelletti94 wants to merge 1 commit into
Open
Guard Relate geometry graph construction against NaN coordinates#1556LucaCappelletti94 wants to merge 1 commit into
LucaCappelletti94 wants to merge 1 commit into
Conversation
michaelkirk
requested changes
Jul 4, 2026
| return; | ||
| } | ||
| self.insert_boundary_point(line.start); | ||
| self.insert_boundary_point(line.end); |
Contributor
Author
There was a problem hiding this comment.
That is me doing merge collisions poorly, but it surprises me that the test suite did not go red. I am doing now some mutation testing to make the test suite more resilient.
| /// | ||
| /// Note: Coords must be non-NaN. | ||
| pub fn insert_node_with_coordinate(&mut self, coord: Coord<F>) -> &mut NF::Node { | ||
| debug_assert!( |
Member
There was a problem hiding this comment.
Leave the assert please. The point is to enforce things that "should never happen".
LucaCappelletti94
force-pushed
the
fix/relate-nan-panic
branch
from
July 4, 2026 18:06
4056bb2 to
a3f3910
Compare
LucaCappelletti94
force-pushed
the
fix/relate-nan-panic
branch
from
July 5, 2026 14:36
a3f3910 to
28dd400
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relatepanicked viadebug_assert!(linear_ring.is_closed())in geometry graph construction when a polygon ring containedNaNcoordinates, becauseis_closeduses==comparison andNaN != NaN. This affected every relate-based predicate (is_intersects,is_contains,is_within, and others).The fix adds non-finite coordinate checks at each geometry entry point in
GeometryGraph:add_polygon_ring,add_line_string,add_line, andadd_point. Each returns early without contributing to the graph when NaN coordinates are encountered, so the relate operation completes with a degenerate but defined result instead of panicking. A now-unreachable NaN assert inNodeMapis removed.