Opened 18 years ago
Last modified 18 years ago
#1064 closed defect (fixed)
GetCentroid on empty polygons crashes
Reported by: | Owned by: | warmerdam | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | OGR_SF | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description
After our discussion on the irc, here is the bug report. Calling GetCentroid() on a OGRPolygon wich is empty, crashes. It seems to be a bug in the geos api geos::WkbReader. Here is the traceback given by Frank Warmerdam (gdb) where #0 geos::Geometry::hasNonEmptyElements (geometries=0x0) at stl_iterator.h:593 #1 0x0016e77d in Polygon (this=0x852ec80, newShell=0x85563b0, newHoles=0x0, newFactory=0x8556318) at stl_alloc.h:656 #2 0x00167f99 in geos::GeometryFactory::createPolygon (this=0x8556318, shell=0x85563b0, holes=0x0) at GeometryFactory.cpp:554 #3 0x001a11a5 in geos::WKBReader::readPolygon (this=0xfef0f520) at ../io/WKBReader.cpp:163 #4 0x001a0ee7 in geos::WKBReader::readGeometry (this=0xfef0f520) at ../io/WKBReader.cpp:103 #5 0x001a0d76 in geos::WKBReader::read (this=0x1, is=@0x0) at ../io/WKBReader.cpp:56 #6 0x00200516 in GEOSGeomFromWKB_buf (wkb=0x852eb78 "\001\003", size=9) at geos_c.cpp:628 #7 0x0131a4c0 in OGRGeometry::exportToGEOS (this=0x852eba8) at ogrgeometry.cpp:1375 #8 0x013184c3 in OGRPolygon::Centroid (this=0x852eba8, poPoint=0x852ebc0) at ogrpolygon.cpp:836 #9 0x0131867e in OGR_G_Centroid (hPolygon=0x852eba8, hCentroidPoint=0x852ebc0) at ogrpolygon.cpp:916 #10 0x00e76018 in _wrap_OGR_G_Centroid (self=0x0, args=0xf7003b6c) at gdal_wrap.c:8587 #11 0x080ea4dd in PyCFunction_Call () #12 0x080ab36d in PyEval_GetFuncDesc () #13 0x080a9059 in PyEval_EvalCode () #14 0x080a9c3e in PyEval_EvalCodeEx () #15 0x080ab42c in PyEval_GetFuncDesc () #16 0x080ab27a in PyEval_GetFuncDesc () #17 0x080a9059 in PyEval_EvalCode () #18 0x080a9c3e in PyEval_EvalCodeEx () #19 0x080a6c37 in PyEval_EvalCode () #20 0x080c99d9 in PyRun_FileExFlags () #21 0x080c850c in PyRun_InteractiveOneFlags () #22 0x080c82a6 in PyRun_InteractiveLoopFlags () #23 0x080c81a7 in PyRun_AnyFileExFlags () #24 0x080553c7 in Py_Main () #25 0x08054de9 in main ()
Change History (2)
comment:2 by , 18 years ago
The problem was the WKBReader in GEOS wasn't handling polygons with no rings. I have fixed this in GEOS-CVS.
Note:
See TracTickets
for help on using tickets.