Opened 4 years ago

Last modified 3 years ago

#1052 new defect

Thread safety: C API contexts use shared GeometryFactory without any refCount synchronization

Reported by: macdrevx Owned by: geos-devel@…
Priority: major Milestone: 3.11.0
Component: Default Version: main
Severity: Unassigned Keywords:
Cc: macdrevx

Description

The C API's GEOSContextHandle_HS initializes its geomFactory fields via

geomFactory = GeometryFactory::getDefaultInstance();

Various operations subsequently utilize the reference counting features of GeometryFactory without synchronization.

We have observed that this can lead to data races.

It appears as though a corruption of the value in _refCount could possibly be harmless so long as GeometryFactory::destroy() is never invoked, thus setting _autoDestroy to true. As far as I can tell, destroy() is never invoked on GeometryFactory returned from getDefaultInstance(), so perhaps we're getting lucky so long as we're only using the C API.

Change History (3)

comment:1 by macdrevx, 4 years ago

Cc: macdrevx added
Version: 3.6.2master

comment:2 by pramsey, 3 years ago

Milestone: 3.10.0

comment:3 by robe, 3 years ago

Milestone: 3.10.03.11.0

Retargeting in prep for GEOS 3.10.0 release

Note: See TracTickets for help on using tickets.