[postgis-tickets] [PostGIS] #4067: DirectFunctionCall* crash when called directly from C code

PostGIS trac at osgeo.org
Mon Apr 9 01:20:04 PDT 2018


#4067: DirectFunctionCall* crash when called directly from C code
----------------------+---------------------------
 Reporter:  ezimanyi  |      Owner:  pramsey
     Type:  defect    |     Status:  new
 Priority:  medium    |  Milestone:  PostGIS 2.4.5
Component:  postgis   |    Version:  2.4.x
 Keywords:            |
----------------------+---------------------------
 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);

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4067>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list