[postgis-tickets] [PostGIS] #4109: WKT parser accepting and interpreting numbers with multiple dots

PostGIS trac at osgeo.org
Mon Jul 23 04:25:11 PDT 2018


#4109: WKT parser accepting and interpreting numbers with multiple dots
----------------------+---------------------------
  Reporter:  strk     |      Owner:  pramsey
      Type:  defect   |     Status:  new
  Priority:  medium   |  Milestone:  PostGIS 2.5.0
 Component:  postgis  |    Version:  trunk
Resolution:           |   Keywords:
----------------------+---------------------------

Comment (by Algunenano):

 Seems like the issue comes from ignoring `WHITESPACE`s in the coordinate
 declaration and supporting numbers as `.5` (0.5):
 {{{
 # select ST_AsEWKT('LINESTRING(.1 .2, .3 .4)'::geometry);
           st_asewkt
 -----------------------------
  LINESTRING(0.1 0.2,0.3 0.4)
 (1 row)

 # select ST_AsEWKT('LINESTRING(.1.2, .3.4)'::geometry);
           st_asewkt
 -----------------------------
  LINESTRING(0.1 0.2,0.3 0.4)
 (1 row)
 }}}

 This probably goes back to 2010.


 I've given it a try in https://github.com/postgis/postgis/pull/277

 After the change:
 {{{
 ERROR:  parse error - invalid geometry
 LINE 1: select ST_AsEWKT('LINESTRING(.1.2, .3.4)'::geometry);
                          ^
 HINT:  "LINESTRING(.1.2," <-- parse error at position 16 within geometry
 }}}

 The main problem is that some other matching rules had to be modified to
 now accept optional whitespaces before or after the main string. It'd nice
 if someone with experience with Bison (or other parsers) could have a look
 to see how it can be improved, and also because I've relied on the tests
 to check if anything was broken.

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