Repository navigation
fix: return an error for a point without coordinates - #81
Merged
Merged
Conversation
pjsier
approved these changes
Nov 20, 2026
pjsier
left a comment
Member
There was a problem hiding this comment.
Thanks for this! This is a good catch that it became an issue
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.
CHANGES.mdorCHANGELOG.mdParsing a
Pointwithout coordinates panics instead of returning an error:read_pointtakes the coordinate withprops.coords.remove(0). Before #68,read_geom_propsrejected empty coordinates, so this was unreachable. Since #68 (first released in 0.10.0) allows them, inputs such as<Point></Point>,<Point><coordinates /></Point>, or aPlacemarkwith such a point panic. As any document can contain one, the panic can be triggered by untrusted input.Change
read_pointnow returnsError::InvalidGeometry("Point must contain a coordinate")when there is no coordinate, like the existing check for a polygon without an outer boundary.Point::coordis not optional, so an error seemed more fitting than a default coordinate. Line strings with empty coordinates still parse, as #68 intended.Tests
test_parse_point_without_coordinateschecks four inputs, including a point nested in aPlacemark. Without the fix, it fails with the panic above.cargo test(46 unit, 4 integration, and 12 doc tests),cargo clippy --all-targets, andcargo fmt --checkpass.