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

PostGIS trac at osgeo.org
Thu Sep 2 02:41:29 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
Resolution:            |   Keywords:
-----------------------+---------------------------

Comment (by strk):

 The code in cstring_to_text("") does:
 {{{
     int len = strlen(""); /* Should be 0 */
     text       *result = (text *) palloc(len + VARHDRSZ);

     SET_VARSIZE(result, len + VARHDRSZ);
     memcpy(VARDATA(result), s, len);

     return result;
 }}}

 So what we're missing is basically the VARHDRSZ in the SET_VARSIZE call
 (we're passing 0 rather than 0 + VARHDRSZ).

 The patch is safe and more readable than doing this "manually", so I'd go
 for it.

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