Opened 7 years ago
Closed 7 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);
In 16542: