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

Paul Ramsey pramsey at cleverelephant.ca
Mon Apr 16 10:26:57 PDT 2018


Author: pramsey
Date: 2018-04-16 10:26:57 -0700 (Mon, 16 Apr 2018)
New Revision: 16542

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


Modified: trunk/libpgcommon/lwgeom_transform.c
===================================================================
--- trunk/libpgcommon/lwgeom_transform.c	2018-04-16 10:35:25 UTC (rev 16541)
+++ trunk/libpgcommon/lwgeom_transform.c	2018-04-16 17:26:57 UTC (rev 16542)
@@ -696,6 +696,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 = MemoryContextStrdup(CacheMemoryContext, nsp_name);;
 	return;



More information about the postgis-tickets mailing list