Change History (21)
comment:1 by , 23 months ago
comment:2 by , 23 months ago
Description: | modified (diff) |
---|
comment:3 by , 23 months ago
The question, as always for these kinds of things, is where to put the fix. We could put a big "no infinites" test at the PostGIS level, before calling into GEOS. Or we could put a test in Quadtree::Root to throw an exception in the case of infinite envelopes, since the Quadtree code is definitely not infinite-safe. I lean towards the latter as the "correct" fix, but it means this won't be fixed "in postgis", but in a patch release of GEOS.
follow-up: 7 comment:4 by , 23 months ago
GEOS is generally not infinite-ordinate-safe. Is it going to be a whack-a-mole exercise to find all of them and add checks? If so, maybe it is best to check for Inf on the PG side, when creating GEOS geometries for passing to GEOS functions?
comment:5 by , 23 months ago
I think the fix should eventually go into GEOS, but given it seems at moment we have only 3 functions in PostGIS impacted, seemed harmless enough to fix at the postgis level.
We do have ST_SetPoint #5319 impacted as well, which is not a GEOS function as I recall, so we still need an easy way to trap infinites on the postgis side.
comment:6 by , 23 months ago
P.S. I didn't test SFCGAL, but I suspect we might have similar issues there too.
follow-up: 8 comment:7 by , 23 months ago
Replying to mdavis:
GEOS is generally not infinite-ordinate-safe.
And yet Envelope says that it can sometimes hold infinite sided bounds! Gah!
I think in general having known infinite loops in GEOS is bad? Like, "feed this function an Inf and it'll lock up on you". So a GEOS patch is not a bad idea?
comment:8 by , 23 months ago
Replying to pramsey:
I think in general having known infinite loops in GEOS is bad? Like, "feed this function an Inf and it'll lock up on you". So a GEOS patch is not a bad idea?
The bright light of a new day has clarified my thinking. Yes, I agree that GEOS should be fixed so that it does not crash for any inputs.
A fix in Quadtree
is probably the minimum required, for this case. I wonder how to fix all the other potential cases of Inf causing crashes? It's tempting to put a check in Envelope creation… but maybe that's too pervasive.
For sure validity checking should be tightened up to report Inf ordinates as invalid.
comment:9 by , 23 months ago
Description: | modified (diff) |
---|
comment:10 by , 23 months ago
comment:12 by , 23 months ago
@pramsey you planning to backport this or just keeping for 3.4?
Also note the others #5315 (crash in ST_Buffer, reported by a user), #5318 (ST_MaximumInscribed circle ) and #5319 a non-geos function.
I can handle the remaining if you want, but would be nice to backport them I think.
I'd also like to put in my new changes to garden crasher that exercises this issue, but can't do that until the patches are complete since it will crash the berries.
comment:13 by , 22 months ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Still need to backport and add a test
backtrace for this