[postgis-tickets] [PostGIS] #2277: Bug in postgis/lwgeom_geos_prepared.c

PostGIS trac at osgeo.org
Mon Apr 22 10:15:09 PDT 2013


#2277: Bug in postgis/lwgeom_geos_prepared.c
---------------------+------------------------------------------------------
 Reporter:  woodbri  |       Owner:  pramsey
     Type:  defect   |      Status:  new    
 Priority:  medium   |   Milestone:         
Component:  postgis  |     Version:  2.0.x  
 Keywords:           |  
---------------------+------------------------------------------------------
 In reading through the code in "postgis/lwgeom_geos_prepared.c" I have
 noticed a bug:

 {{{
 static void
 DeletePrepGeomHashEntry(MemoryContext mcxt)
 {
     void **key;
     PrepGeomHashEntry *he;

     /* The hash key is the MemoryContext pointer */
     key = (void *)&mcxt;

     /* Delete the projection object from the hash */
     he = (PrepGeomHashEntry *) hash_search(PrepGeomHash, key, HASH_REMOVE,
 NULL);

     he->prepared_geom = NULL;
     he->geom = NULL;

     if (!he)
         elog(ERROR, "DeletePrepGeomHashEntry: There was an error removing
 the geometry object from this MemoryContext (%p)", (void *)mcxt);
 }
 }}}

 Notice that  if he == NULL, you will never get to the if (!he) statement
 because you will have already segv'd on the prior two statements trying to
 access he.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2277>
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-tickets mailing list