Opened 15 years ago

Closed 15 years ago

#3099 closed defect (fixed)

OGRBuildPolygonFromEdges() segfaults on MULTIPOLYGON inputs

Reported by: dron Owned by: Even Rouault
Priority: normal Milestone: 1.7.0
Component: OGR_SF Version: unspecified
Severity: normal Keywords:
Cc: warmerdam

Description

OGRBuildPolygonFromEdges() can't properly handle a case when the MULTIPOLYGON geometry supplied as an input. The test case follows:

#!/usr/bin/env python

from osgeo import ogr

g=ogr.Geometry(wkt="MULTIPOLYGON (((20 15,15 15,15 20,20 20,20 15)),((17 10,17 12,20 12, 20 10,17 10)))")
ogr.BuildPolygonFromEdges(g, bAutoClose=1)

This script results in segmentation fault. I think that OGRBuildPolygonFromEdges() should either refuse to work with such a geometry or return a multipolygon as a result.

Best regards, Andrey

Change History (4)

comment:1 by dron, 15 years ago

Component: defaultOGR_SF

comment:2 by warmerdam, 15 years ago

Cc: warmerdam added
Milestone: 1.7.0
Owner: changed from warmerdam to chaitanya

Agreed.

Chaitanya, could you please modify the function (in gdal/ogr/ograssemblepolygon.cpp to error out in an informative way for non-linestring (or linearring) geometries in the passed in collection? Also, please extend the test suite with this change. It would be sufficient to do this in trunk.

comment:3 by Even Rouault, 15 years ago

Owner: changed from chaitanya to Even Rouault
Status: newassigned

comment:4 by Even Rouault, 15 years ago

Resolution: fixed
Status: assignedclosed

Fixed in trunk (r17556). Tests added in r17557

Note: See TracTickets for help on using tickets.