Opened 11 years ago

Closed 11 years ago

#2277 closed defect (fixed)

Bug in postgis/lwgeom_geos_prepared.c

Reported by: woodbri Owned by: pramsey
Priority: medium Milestone:
Component: postgis Version: 2.0.x
Keywords: Cc:

Description

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.

Change History (1)

comment:1 by pramsey, 11 years ago

Resolution: fixed
Status: newclosed

Trunk at r11315

2.0 at r11316

1.5 at r11317

1.4 at r11318

Note: See TracTickets for help on using tickets.