From: Paul Ramsey Date: Mon, 16 Apr 2018 17:26:57 +0000 (+0000) Subject: Guard against lookup failure, to avoid segfault in internally called case (references... X-Git-Tag: 2.5.0alpha~28 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff4e2443880834ff68eccaa77a9e0b0cfa325d16;p=postgis Guard against lookup failure, to avoid segfault in internally called case (references #4067) git-svn-id: http://svn.osgeo.org/postgis/trunk@16542 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/libpgcommon/lwgeom_transform.c b/libpgcommon/lwgeom_transform.c index a6c46c22b..b793635a9 100644 --- a/libpgcommon/lwgeom_transform.c +++ b/libpgcommon/lwgeom_transform.c @@ -696,6 +696,9 @@ SetSpatialRefSysSchema(FunctionCallInfo fcinfo) 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;