[postgis-devel] [PostGIS] #688: ST_Contains POLYGON Empty with real linestring crash

PostGIS trac at osgeo.org
Wed Dec 8 13:56:03 PST 2010


#688: ST_Contains POLYGON Empty with real linestring crash
---------------------+------------------------------------------------------
 Reporter:  robe     |       Owner:  pramsey      
     Type:  defect   |      Status:  new          
 Priority:  medium   |   Milestone:  PostGIS 2.0.0
Component:  postgis  |     Version:  trunk        
 Keywords:           |  
---------------------+------------------------------------------------------
Description changed by robe:

Old description:

> {{{
> SELECT
> ST_Contains(ST_GeomFromText('LINESTRING(-10 50,50 -10,4326
> ST_GeomFromText('POLYGON EMPTY',4326));
> }}}
>
> -- the actual query that crashed -- teh above is a distilled subset but
> there may be more monsters lurking in this query
>
> {{{
> SELECT ST_Contains(foo1.the_geom, foo2.the_geom) As result,
> ST_AsText(foo1.the_geom) As ref1_geom, ST_AsText(foo2.the_geom) As
> ref2_geom
>         FROM ((SELECT
> ST_MakeLine(ST_SetSRID(ST_MakePointM(i,j,m),4326),ST_SetSRID(ST_MakePointM(j,i,m),4326))
> As the_geom
>                 FROM generate_series(-10,50,10) As i
>                         CROSS JOIN generate_series(50,70, 20) As j
>                         CROSS JOIN generate_series(1,2) As m
>                         WHERE NOT(i = j)
>                         ORDER BY i, j, m, i*j*m)) As foo1 CROSS JOIN
> ((SELECT ST_GeomFromText('GEOMETRYCOLLECTION EMPTY',4326) As the_geom
>                         UNION ALL SELECT ST_GeomFromText('POLYGON
> EMPTY',4326) As the_geom
>                         UNION ALL SELECT ST_GeomFromText('POINT
> EMPTY',4326) As the_geom
>                         UNION ALL SELECT ST_GeomFromText('MULTIPOINT
> EMPTY',4326) As the_geom
>                         UNION ALL SELECT ST_GeomFromText('MULTIPOLYGON
> EMPTY',4326) As the_geom
>                         UNION ALL SELECT ST_GeomFromText('LINESTRING
> EMPTY',4326) As the_geom
>                         UNION ALL SELECT ST_GeomFromText('MULTILINESTRING
> EMPTY',4326) As the_geom ) ) As foo2
> }}}

New description:

 {{{
 SELECT
 ST_Contains(ST_GeomFromText('LINESTRING(-10 50,50 -10)',4326),
 ST_GeomFromText('POLYGON EMPTY',4326));
 }}}

 The above doesn't always crash the first time but does after second or
 third call.
 -- the actual query that crashed -- the above is a distilled subset but
 there may be more monsters lurking in this query

 {{{
 SELECT ST_Contains(foo1.the_geom, foo2.the_geom) As result,
 ST_AsText(foo1.the_geom) As ref1_geom, ST_AsText(foo2.the_geom) As
 ref2_geom
         FROM ((SELECT
 ST_MakeLine(ST_SetSRID(ST_MakePointM(i,j,m),4326),ST_SetSRID(ST_MakePointM(j,i,m),4326))
 As the_geom
                 FROM generate_series(-10,50,10) As i
                         CROSS JOIN generate_series(50,70, 20) As j
                         CROSS JOIN generate_series(1,2) As m
                         WHERE NOT(i = j)
                         ORDER BY i, j, m, i*j*m)) As foo1 CROSS JOIN
 ((SELECT ST_GeomFromText('GEOMETRYCOLLECTION EMPTY',4326) As the_geom
                         UNION ALL SELECT ST_GeomFromText('POLYGON
 EMPTY',4326) As the_geom
                         UNION ALL SELECT ST_GeomFromText('POINT
 EMPTY',4326) As the_geom
                         UNION ALL SELECT ST_GeomFromText('MULTIPOINT
 EMPTY',4326) As the_geom
                         UNION ALL SELECT ST_GeomFromText('MULTIPOLYGON
 EMPTY',4326) As the_geom
                         UNION ALL SELECT ST_GeomFromText('LINESTRING
 EMPTY',4326) As the_geom
                         UNION ALL SELECT ST_GeomFromText('MULTILINESTRING
 EMPTY',4326) As the_geom ) ) As foo2
 }}}

--

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/688#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list