Opened 14 years ago
Closed 13 years ago
#712 closed defect (fixed)
ST_IsValidDetail and ST_IsValidReason POLYGON CRASH
Reported by: | robe | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.0.0 |
Component: | postgis | Version: | master |
Keywords: | Cc: |
Description
SELECT ST_IsValidDetail(ST_GeomFromText('POLYGON EMPTY',4326)) CRASH:
Again other empties don't seem to crash: e.g. SELECT ST_IsValidDetail(ST_GeomFromText('MULTIPOLYGON EMPTY',4326));
returns: (t)
SELECT ST_IsValidDetail(ST_GeomFromText('LINESTRING EMPTY',4326)); returns (t)
some return not supported.
Change History (4)
comment:1 by , 14 years ago
Summary: | ST_IsValidDetail POLYGON CRASH → ST_IsValidDetail and ST_IsValidReason POLYGON CRASH |
---|
comment:2 by , 14 years ago
sorry formatting got messed up — this crashes SELECT ST_IsValidReason(ST_GeomFromText('POLYGON EMPTY',4326));
—this works as long as you don't introduce POLYGON EMPTY
SELECT ST_IsValidReason(geom), ST_IsValidDetail(geom) FROM (SELECT ST_GeomFromText('POINT EMPTY',4326) UNION ALL SELECT ST_GeomFromText('MULTIPOINT EMPTY',4326) UNION ALL SELECT ST_GeomFromText('MULTIPOLYGON EMPTY',4326) UNION ALL SELECT ST_GeomFromText('LINESTRING EMPTY',4326) UNION ALL SELECT ST_GeomFromText('MULTILINESTRING EMPTY',4326) ) As foo(geom);
comment:3 by , 13 years ago
It looks pretty easy if one knows what the form of a GEOS empty polygon is. In the case of LWGEOM, it's coming in with nrings == 0 and rings == NULL, so it crashes when it tries to dereference rings[0]. Instead of de-referencing it should be checking for nrings == 0 and in that case constructing an empty polygon.
It looks like both the LINESTRING and POINT cases work because they are going in with a non-null POINTARRAY that has npoints == 0 and *serialized_ptlist == NULL. So the GEOS interpretation of "empty" is working in those cases. Any help you can provide, appreciated.
For GEOS 3.3 you've provided nice easy createEmpty signatures, but what happened for pre-3.3? We did pass in empty geometry collections, right? I've got GEOS 3.2 and it's handling every other empty just fine.
comment:4 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
SELECT ST_IsValidReason(ST_GeomFromText('POLYGON EMPTY',4326)) also crashes.
{{{ —this works as long as you don't introduce POLYGON EMPTY SELECT ST_IsValidReason(geom), ST_IsValidDetail(geom) FROM (SELECT ST_GeomFromText('POINT EMPTY',4326)
}}}