Opened 9 years ago
Closed 5 years ago
#730 closed patch (fixed)
[Patch] AbstractSTRtree::query segfaults if tree is empty
Reported by: | framm | Owned by: | strk |
---|---|---|---|
Priority: | minor | Milestone: | 3.6.4 |
Component: | Core | Version: | main |
Severity: | Unassigned | Keywords: | tree query segfault |
Cc: |
Description
If no items have been added to a tree, AbstractSTRtree::query() will execute an "intersects" call where one of the arguments is NULL, thus leading to a segmentation violation.
The expected behaviour of query() when querying an empty tree is to simply return an empty result.
Querying an empty tree might sound silly but if you're dealing with a larger system where the tree has been populated in another component you might not always know how many elements have been added, and the tree doesn't offer a public method like "isEmpty" or so.
The attached patch fixes the problem by immediately returning from query() if the tree is empty.
Attachments (1)
Change History (9)
by , 9 years ago
Attachment: | query.diff added |
---|
comment:4 by , 6 years ago
Milestone: | 3.6.3 → 3.6.4 |
---|---|
Type: | defect → patch |
comment:5 by , 6 years ago
Well, better late than never applying this: https://github.com/libgeos/geos/pull/116
framm, do you want to give your name for the commit log?
comment:7 by , 6 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Looks like this was only applied to 3.7, were you going to apply to 3.6.4 or you think safer to just keep on 3.7?
Patch for AbstractSTRtree.cpp