[postgis-devel] [PostGIS] #179: ST_MakeLine and ST_MakeLine_Garry crash server with null arrays

PostGIS trac at osgeo.org
Sat Sep 12 16:53:31 PDT 2009


#179: ST_MakeLine and ST_MakeLine_Garry crash server with null arrays
----------------------+-----------------------------------------------------
  Reporter:  robe     |       Owner:  pramsey      
      Type:  defect   |      Status:  reopened     
  Priority:  medium   |   Milestone:  postgis 1.3.7
 Component:  postgis  |     Version:  1.3.X        
Resolution:           |    Keywords:               
----------------------+-----------------------------------------------------
Comment (by nicklas):

 I have made a new ry to understand this.
 I think I know where the problem is.


 I added a notice under the array-handler offset at line 2174 in
 lwgeom_functions_basic:

 {{{
 offset += INTALIGN(VARSIZE(geom));
 lwnotice("offset%d",offset);
 continue;
 }}}

 By studing the offset it showed that
 the NULL-values is counted as elements in the array in ndim of the array
 structure
  but:

 {{{
 INTALIGN(VARSIZE(geom))
 }}}

 don't notice the NULL-values and just gets the size of the next element.
 This causes the loop to continue beyond the array in the memory when there
 is iterations to be done according to nelems but the actual geometries is
 already used. That makes the rest of the offsets randomly depending on
 what is comming after in memory.

 I think Regina, that's why we didn't always had crashes because it did no
 harm if the memory after the array wasnot used.

 I don't know how to handle it.

 As I understand it we have to sort away the NULL-values before they reach
 that internal array-structure and gets counted. Is that a postgresql-
 thing. How do they handle it?

 /Nicklas

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/179#comment:11>
PostGIS <http://trac.osgeo.org/postgis/>
PostGIS


More information about the postgis-devel mailing list