Opened 14 years ago

Closed 14 years ago

#370 closed defect (fixed)

lwgeom_free not empty safe

Reported by: robe Owned by: pramsey
Priority: medium Milestone: PostGIS 1.5.0
Component: postgis Version: master
Keywords: Cc:

Description (last modified by pramsey)

SELECT ST_CollectionExtract(foo1.the_geom, 3) 
  FROM ((SELECT ST_GeomFromText('GEOMETRYCOLLECTION EMPTY',4326) As the_geom
  UNION ALL SELECT ST_GeomFromText('POLYGON EMPTY',4326) As the_geom
)
) As foo1
LIMIT 3;

Crashes server.

Change History (3)

comment:1 by pramsey, 14 years ago

Description: modified (diff)

comment:2 by pramsey, 14 years ago

Summary: ST_CollectionExtract not Empty safelwgeom_free not empty safe

In fact, the problem is a little deeper. Hard to believe we don't do this in other places, but it seems to be a generic problem with freeing empties, or more to the point, that the lwgeom's returned by pglwgeom_deserialize aren't constructed in such a way we can free them safely. More investigation req'd.

comment:3 by pramsey, 14 years ago

Resolution: fixed
Status: newclosed

Fixed up de-serialization routines to avoid *geoms = malloc(0) cases which were causing free to fail later on down the line (r5099)

Note: See TracTickets for help on using tickets.