[geos-devel] [GEOS] #912: bintree::Bintree API hides implementation and leads to SEGFAULT.
GEOS
geos-trac at osgeo.org
Mon Aug 13 10:07:46 PDT 2018
#912: bintree::Bintree API hides implementation and leads to SEGFAULT.
------------------------+--------------------------
Reporter: basiliscos | Owner: geos-devel@…
Type: defect | Status: new
Priority: major | Milestone:
Component: Default | Version: 3.6.2
Severity: Unassigned | Keywords:
------------------------+--------------------------
Bintree::insert (Interval *itemInterval, void *item) states
Parameters
{{{
itemInterval Ownership left to caller, NO reference hold by this class.
item Ownership left to caller, reference kept by this class.
}}}
In implementation it leads to
{{{
root->insert(insertInterval,item);
...
void NodeBase::add(void* item){
items->push_back(item);
}
}}}
and in the destructor of NodeBase
{{{
NodeBase::~NodeBase() {
for(int i=0;i<(int)items->size();i++) {
delete (MonotoneChain*)(*items)[i];
}
}}}
it, first, casts to '''MonotoneChain''' (i.e. it violates void* contract),
and, second, it invokes destructor, i.e. opposite to what is stated in
documentation about item ownership.
Please, fix.
--
Ticket URL: <https://trac.osgeo.org/geos/ticket/912>
GEOS <http://trac.osgeo.org/geos>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).
More information about the geos-devel
mailing list