Changes between Version 1 and Version 2 of Ticket #6312
- Timestamp:
- Jan 15, 2016, 3:41:05 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #6312 – Description
v1 v2 1 Perhaps this is not a naturally oc urring use case scenario, but the SetGeomField member function of OGRFeature that takes the field index as parameter is not robust, in that it does not check whether the old geometry pointer is the same as the new one. In the case that they are the same ({{{papoGeometries[iField] == poGeomIn}}}) the call of the {{{clone()}}} method (line 744 of ogrfeature.cpp in trunk) causes memory access violation, because the geometry's destructor is executed in the preceding delete statement (line 741 of ogrfeature.cpp).1 Perhaps this is not a naturally occurring use case scenario, but the SetGeomField member function of OGRFeature that takes the field index as parameter is not robust, in that it does not check whether the old geometry pointer is the same as the new one. In the case that they are the same ({{{papoGeometries[iField] == poGeomIn}}}) the call of the {{{clone()}}} method (line 744 of ogrfeature.cpp in trunk) causes memory access violation, because the geometry's destructor is executed in the preceding delete statement (line 741 of ogrfeature.cpp). 2 2 3 3 Fix: save {{{papoGeometries[iField]}}} to a temp variable and delete it afterwards 4 4 5 5 {{{ 6 OGRGeometry * oldGeometry = papoGeometries[iField];6 OGRGeometry *poOldGeometry = papoGeometries[iField]; 7 7 8 8 ... 9 9 10 delete oldGeometry;10 delete poOldGeometry; 11 11 }}} 12 12