[postgis-tickets] [PostGIS] #4982: Problem when calling the buffer function from MobilityDB

PostGIS trac at osgeo.org
Tue Aug 24 07:27:42 PDT 2021


#4982: Problem when calling the buffer function from MobilityDB
----------------------+---------------------------
 Reporter:  ezimanyi  |      Owner:  pramsey
     Type:  defect    |     Status:  new
 Priority:  medium    |  Milestone:  PostGIS 3.1.4
Component:  postgis   |    Version:  2.5.x
 Keywords:            |
----------------------+---------------------------
 I get an error when calling the C function
 {{{
 Datum buffer(PG_FUNCTION_ARGS)
 }}}
 with only two arguments, the third one being optional
 {{{
 ERROR:  invalid memory alloc request size 18446744073709551613
 }}}
 The problem is solved when I modify the function as follows
 {{{
 PG_FUNCTION_INFO_V1(buffer);
 Datum buffer(PG_FUNCTION_ARGS)
 {
   [...]
   text *params_text;

   if (PG_NARGS() > 2)
   {
     params_text = PG_GETARG_TEXT_P(2);
   }
   else
   {
     // params_text = palloc(VARHDRSZ); <- ORIGINAL DEFINITION
     // SET_VARSIZE(params_text, 0);
     params_text = cstring_to_text(""); // <- PROPOSED SOLUTION
   }
   [...]
 }
 }}}

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4982>
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