Opened 6 years ago

Closed 6 years ago

#4067 closed defect (fixed)

DirectFunctionCall* crash when called directly from C code

Reported by: ezimanyi Owned by: pramsey
Priority: medium Milestone: PostGIS 2.4.5
Component: postgis Version: 2.4.x
Keywords: Cc:

Description

Functions that use SetSpatialRefSysSchema will crash when called directly from C code (like with DirectFunctionCall* and such). This patches adds a guard against that issue.

diff -urdN a/libpgcommon/lwgeom_transform.c b/libpgcommon/lwgeom_transform.c —- a/libpgcommon/lwgeom_transform.c 2018-01-16 06:31:17.000000000 +0100 +++ b/libpgcommon/lwgeom_transform.c 2018-03-05 14:29:47.644394250 +0100 @@ -740,6 +740,7 @@

if (!fcinfo
!fcinfo→flinfo) return;

nsp_name = get_namespace_name(get_func_namespace(fcinfo→flinfo→fn_oid));

+ if(!nsp_name) return ;

elog(DEBUG4, "%s located %s in namespace %s", func, get_func_name(fcinfo→flinfo→fn_oid), nsp_name);

spatialRefSysSchema = MemoryContextAlloc(CacheMemoryContext, strlen(nsp_name)+1);

Change History (2)

comment:1 by pramsey, 6 years ago

In 16542:

Guard against lookup failure, to avoid segfault in internally called case (references #4067)

comment:2 by pramsey, 6 years ago

Resolution: fixed
Status: newclosed

In 16543:

Guard against lookup failure, to avoid segfault in internally called case (closes #4067)

Note: See TracTickets for help on using tickets.