[postgis-tickets] r16543 - Guard against lookup failure, to avoid segfault in internally called case (closes #4067)

Paul Ramsey pramsey at cleverelephant.ca
Mon Apr 16 10:28:27 PDT 2018


Author: pramsey
Date: 2018-04-16 10:28:27 -0700 (Mon, 16 Apr 2018)
New Revision: 16543

Modified:
   branches/2.4/NEWS
   branches/2.4/libpgcommon/lwgeom_transform.c
Log:
Guard against lookup failure, to avoid segfault in internally called case (closes #4067)



Modified: branches/2.4/NEWS
===================================================================
--- branches/2.4/NEWS	2018-04-16 17:26:57 UTC (rev 16542)
+++ branches/2.4/NEWS	2018-04-16 17:28:27 UTC (rev 16543)
@@ -18,6 +18,7 @@
            (Paul Ramsey, Darafei Praliaskouski)
   - #4052, schema qualify several functions in geography (Regina Obe)
   - #4055, ST_ClusterIntersecting drops SRID (Daniel Baston)
+  - #4067, Guard lookup of namespace in internal call case
 
  * Enhancements *
   - #3946, Compile support for PgSQL 11 (Paul Ramsey)

Modified: branches/2.4/libpgcommon/lwgeom_transform.c
===================================================================
--- branches/2.4/libpgcommon/lwgeom_transform.c	2018-04-16 17:26:57 UTC (rev 16542)
+++ branches/2.4/libpgcommon/lwgeom_transform.c	2018-04-16 17:28:27 UTC (rev 16543)
@@ -746,6 +746,9 @@
 	if (!fcinfo || !fcinfo->flinfo) return;
 
 	nsp_name = get_namespace_name(get_func_namespace(fcinfo->flinfo->fn_oid));
+	/* early exit if we cannot lookup nsp_name, cf #4067 */
+	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);



More information about the postgis-tickets mailing list