Ticket #357 (closed defect: fixed)
RobustDeterminant is not robust
| Reported by: | rdool | Owned by: | strk |
|---|---|---|---|
| Priority: | major | Milestone: | 3.3.0 |
| Component: | Core | Version: | 3.1.0 |
| Severity: | Annoyance | Keywords: | |
| Cc: |
Description
int RobustDeterminant::signOfDet2x2(double x1,double y1,double x2,double y2)
This method loops endlessly when the initial parameters x1,y1,x2,y2 all have the value -nan (0x8000000000000).
The following stacktrace is causing the method to loop endlessly.
#0 geos::algorithm::RobustDeterminant::signOfDet2x2 (x1=-nan(0x8000000000000), y1=-nan(0x8000000000000), x2=-nan(0x8000000000000),
y2=-nan(0x8000000000000)) at RobustDeterminant.cpp:212
#1 0x00007f170df5cf9e in geos::algorithm::CGAlgorithms::isCCW (ring=<value optimized out>) at CGAlgorithms.cpp:219
#2 0x00007f170df8a2f8 in geos::geomgraph::GeometryGraph::addPolygonRing (this=0xc42e90, lr=0xb32250, cwLeft=2, cwRight=0)
at GeometryGraph.cpp:248
#3 0x00007f170df8a49e in geos::geomgraph::GeometryGraph::addPolygon (this=0xc42e90, p=0xb8b840) at GeometryGraph.cpp:274
#4 0x00007f170df8ade3 in geos::geomgraph::GeometryGraph::add (this=0xc42e90, g=0xb8b840) at GeometryGraph.cpp:178
#5 0x00007f170dfb9235 in GeometryGraphOperation (this=<value optimized out>, g0=0xbc76d0, g1=0xb8b840)
at ../../source/headers/geos/geomgraph/GeometryGraph.inl:59
#6 0x00007f170dfd9826 in RelateOp (this=0xfff8000000000000, g0=0x400, g1=0xc3fe68) at RelateOp.cpp:44
#7 0x00007f170dfd988f in geos::operation::relate::RelateOp::relate (a=<value optimized out>, b=<value optimized out>) at RelateOp.cpp:38
#8 0x00007f170df6cf98 in geos::geom::Geometry::intersects (this=0xbc76d0, g=0xb8b840) at Geometry.cpp:367
#9 0x00007f170e471b4a in GEOSIntersects (g1=0xfff8000000000000, g2=0x400) at geos_c.cpp:177
#10 0x00007f170e6a67b2 in intersects () from /usr/lib/postgresql/8.3/lib/liblwgeom.so
I think methods that do calculations should verify the initial conditions with assert-like statements. To protect against NAN is only possible with negative if-statements since every logical test of a NAN value results into False. The last property is also causing the endless looping process.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

