Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#1085 closed defect (fixed)

RelateOp crashes on input with empty components

Reported by: strk Owned by: strk
Priority: blocker Milestone: 3.6.5
Component: Default Version: 3.6.4
Severity: Unassigned Keywords:
Cc:

Description

From https://trac.osgeo.org/postgis/ticket/4814#comment:4 we observe a crash in RelateOp when inputs contain empty components.

Inputs:

LINESTRING(10 0,0 10)
MULTILINESTRING((10 -10,-10 10), EMPTY)

Valgrind report:

==21144== Invalid read of size 8
==21144==    at 0x19D4F4C2: operator== (Coordinate.inl:123)
==21144==    by 0x19D4F4C2: geos::algorithm::PointLocator::locate(geos::geom::Coordinate const&, geos::geom::LineString const*) (PointLocator.cpp:133)
==21144==    by 0x19D4F870: geos::algorithm::PointLocator::computeLocation(geos::geom::Coordinate const&, geos::geom::Geometry const*) (PointLocator.cpp:82)
==21144==    by 0x19D4FA88: geos::algorithm::PointLocator::locate(geos::geom::Coordinate const&, geos::geom::Geometry const*) (PointLocator.cpp:55)
==21144==    by 0x19DDF78F: geos::operation::relate::RelateComputer::labelIsolatedNode(geos::geomgraph::Node*, int) (RelateComputer.cpp:509)
==21144==    by 0x19DDF847: geos::operation::relate::RelateComputer::labelIsolatedNodes() (RelateComputer.cpp:499)
==21144==    by 0x19DDFDCD: geos::operation::relate::RelateComputer::computeIM() (RelateComputer.cpp:162)
==21144==    by 0x19DE0774: geos::operation::relate::RelateOp::relate(geos::geom::Geometry const*, geos::geom::Geometry const*) (RelateOp.cpp:42)
==21144==    by 0x19D59710: relate (Geometry.cpp:456)
==21144==    by 0x19D59710: geos::geom::Geometry::intersects(geos::geom::Geometry const*) const (Geometry.cpp:344)
==21144==    by 0x194090E0: GEOSIntersects_r (geos_ts_c.cpp:500)

Change History (7)

comment:1 by strk, 3 years ago

Owner: changed from geos-devel@… to strk
Priority: majorblocker
Status: newassigned

comment:2 by strk, 3 years ago

3.7.3dev is NOT affected

comment:3 by strk, 3 years ago

3.8.2dev-CAPI-1.13.3 NOT affected either

comment:4 by strk, 3 years ago

3.9.1dev-CAPI-1.16.2 also NOT affected, will fix in 3.6 branch and close this ticket

comment:5 by Sandro Santilli <strk@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In e7caa33/git:

Fix crash on relating geoms with empty components

Closes #1085 in 3.6 branch (3.6.4dev)
Includes tests

comment:6 by strk, 3 years ago

Tests were added in all branches

comment:7 by strk, 3 years ago

Milestone: 3.6.43.6.5
Version: 3.6.33.6.4
Note: See TracTickets for help on using tickets.