[postgis-users] Bug in postgis/lwgeom_geos_prepared.c

Stephen Woodbridge woodbri at swoodbridge.com
Mon Apr 22 10:12:11 PDT 2013


http://trac.osgeo.org/postgis/ticket/2277

On 4/22/2013 1:04 PM, Stephen Woodbridge wrote:
> In reading through the code in "postgis/lwgeom_geos_prepared.c" I have
> noticed a bug that you probably should fix:
>
> 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.



More information about the postgis-users mailing list