[postgis-tickets] [PostGIS] #4165: ST_AsText hangs backend

PostGIS trac at osgeo.org
Fri Aug 31 04:22:19 PDT 2018


#4165: ST_AsText hangs backend
-----------------------+---------------------------
  Reporter:  komzpa    |      Owner:  pramsey
      Type:  defect    |     Status:  new
  Priority:  critical  |  Milestone:  PostGIS 2.5.0
 Component:  postgis   |    Version:  trunk
Resolution:            |   Keywords:
-----------------------+---------------------------

Comment (by Algunenano):

 Seems pretty bad. With the following change to the tests you get a
 coredump:
 {{{
 diff --git a/liblwgeom/cunit/cu_out_wkt.c b/liblwgeom/cunit/cu_out_wkt.c
 index c070efbd5..db502cf2a 100644
 --- a/liblwgeom/cunit/cu_out_wkt.c
 +++ b/liblwgeom/cunit/cu_out_wkt.c
 @@ -52,7 +52,7 @@ static char* cu_wkt(char *wkt, uint8_t variant)
          printf("error converting '%s' to lwgeom\n", wkt);
          exit(0);
      }
 -  s = lwgeom_to_wkt(g, variant, 8, NULL);
 +  s = lwgeom_to_wkt(g, variant, 36, NULL);
      lwgeom_free(g);
      return s;
 }}}

 {{{
 #0  0x00007f9686fdbd7f in raise () from /usr/lib/libc.so.6
 #1  0x00007f9686fc6672 in abort () from /usr/lib/libc.so.6
 #2  0x00007f9686fc6548 in __assert_fail_base.cold.0 () from
 /usr/lib/libc.so.6
 #3  0x00007f9686fd4396 in __assert_fail () from /usr/lib/libc.so.6
 #4  0x00007f96875ad1c1 in lwprint_double (d=<optimized out>,
 maxdd=<optimized out>,
     buf=0x7ffc95e2ec00 "0.1111", '0' <repeats 13 times>,
 "430766533554560737", bufsize=38) at lwprint.c:510
 #5  0x00007f968759e66a in ptarray_to_wkt_sb (ptarray=<optimized out>,
 sb=0x55b812ee3200, precision=36, variant=<optimized out>)
     at lwout_wkt.c:112
 #6  0x00007f968759cfb2 in lwgeom_to_wkt (geom=0x55b812ee3a10, variant=1
 '\001', precision=36, size_out=0x0) at lwout_wkt.c:687
 #7  0x000055b812baee38 in cu_wkt (wkt=<optimized out>, variant=1 '\001')
 at cu_out_wkt.c:55
 }}}

 I guess that `char coord[OUT_DOUBLE_BUFFER_SIZE];` doesn't have enough
 size and should be allocated dynamically.

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