Opened 4 years ago

Closed 4 years ago

#3404 closed defect (fixed)

ST_ClusterWithin crashes backend

Reported by: dbaston Owned by: dbaston
Priority: blocker Milestone: PostGIS 2.2.1
Component: postgis Version: 2.2.x
Keywords: Cc:

Description

The UF_ordered_by_cluster function assumes that UF_find will fully compress all paths, ie after a call to UF_find(uf, i), we can say that uf->clusters[i] = UF_find(uf, i).

It's possible to end up with a situation where this does not hold; I've run across one in an input set of 24,000 points. The consequence of this is that the combine_geometries routine will produce more geometries than expected, and will overflow a block of allocated memory.

I'll commit a fix to (a) make sure that UF_find fully compresses paths, resolving the root cause of the problem, and (b) include a guard in combine_geometries so that we can return an error instead of overflowing.

Change History (2)

comment:1 Changed 4 years ago by dbaston

Owner: changed from pramsey to dbaston
Status: newassigned

comment:2 Changed 4 years ago by dbaston

Resolution: fixed
Status: assignedclosed

Fixed in trunk at r14507, 2.2 at r14508

Note: See TracTickets for help on using tickets.