[postgis-devel] [PostGIS] #210: segmentation faults in lwgeom_geos.c:pgis_union_geometry_array

PostGIS trac at osgeo.org
Sat Jun 27 13:45:42 PDT 2009

#210: segmentation faults in lwgeom_geos.c:pgis_union_geometry_array
  Reporter:  dfuhriman  |       Owner:  robe         
      Type:  defect     |      Status:  assigned     
  Priority:  medium     |   Milestone:  postgis 1.3.7
 Component:  postgis    |     Version:  trunk        
Resolution:             |    Keywords:               
Comment (by mcayland):

 Okay - I've worked out what's going on here. What is happening is that the
 code used to implement the aggregates does not handle NULLs correctly :(

 The issue is that NULLs in PostgreSQL arrays are stored in an out-of-array
 bitmap and so unless you check the bitmap to find out which elements to
 skip, you go outside of the allocated data area since NULLs *are* included
 in the element count.

 Please find attached a work-in-progress patch against 1.4 that makes
 ST_Union() NULL safe - can everyone test and make sure I didn't break
 anything? If it works, I'll do the same to the other aggregates, including
 ST_MakeLine() which was the cause of one of Regina's failures.

 With the attached patch applied I can now do this:

 postgis=# select  st_numgeometries(ST_Union(the_geom)) from foo;

 (1 row)

 (1 row)



Ticket URL: <http://trac.osgeo.org/postgis/ticket/210#comment:14>
PostGIS <http://trac.osgeo.org/postgis/>

More information about the postgis-devel mailing list