#4273 closed defect (fixed)
too permissive WKT parser
Reported by: | komzpa | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.5.2 |
Component: | postgis | Version: | 2.4.x |
Keywords: | Cc: |
Description (last modified by )
SELECT name, similarity(name, 'Минск') AS dist FROM planet_osm_point WHERE name % 'Минск' AND ST_DWithin(ST_Transform(way, 4326)::geography, ST_GeomFromText('POINT(27.5618791 53.902334)::geography', 4326), 50000) ORDER BY dist DESC;
User by mistake added a cast on wrong side of ' ' and we did not get any parse error.
23:06:43 [kom] > select ST_AsEWKT(ST_GeomFromText('POINT(27.5618791 53.902334)::geography', 4326)); ┌───────────────────────────────────────┐ │ st_asewkt │ ├───────────────────────────────────────┤ │ SRID=4326;POINT(27.5618791 53.902334) │ └───────────────────────────────────────┘ (1 row) Time: 3,475 ms
Change History (15)
comment:1 by , 6 years ago
Description: | modified (diff) |
---|
comment:3 by , 6 years ago
This gets weirder... a test case like
SELECT 'POINT(1 2) foobar'::geometry
will be parsed by PostGIS happily, but if I take that same case and run it in cunit, I get
parse error - invalid geometry
comment:8 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:9 by , 6 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
This added a memory leak (detected in Travis): https://travis-ci.org/postgis/postgis/jobs/477506330
==6378== ==6378== HEAP SUMMARY: ==6378== in use at exit: 7,977 bytes in 200 blocks ==6378== total heap usage: 126,917 allocs, 126,717 frees, 6,896,829 bytes allocated ==6378== ==6378== 120 (32 direct, 88 indirect) bytes in 1 blocks are definitely lost in loss record 198 of 200 ==6378== at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==6378== by 0x486D674: lwpoint_construct (lwpoint.c:137) ==6378== by 0x4884C56: wkt_parser_point_new (lwin_wkt.c:345) ==6378== by 0x4882724: wkt_yyparse (lwin_wkt_parse.y:514) ==6378== by 0x4882CE5: lwgeom_parse_wkt (lwin_wkt_parse.y:68) ==6378== by 0x14361D: cu_wkt_in (cu_in_wkt.c:56) ==6378== by 0x14442B: test_wkt_in_point (cu_in_wkt.c:71) ==6378== by 0x4933336: ??? (in /usr/lib/x86_64-linux-gnu/libcunit.so.1.0.1) ==6378== by 0x493356C: ??? (in /usr/lib/x86_64-linux-gnu/libcunit.so.1.0.1) ==6378== by 0x49339DD: CU_run_all_tests (in /usr/lib/x86_64-linux-gnu/libcunit.so.1.0.1) ==6378== by 0x110432: main (cu_tester.c:177)
Note:
See TracTickets
for help on using tickets.
Really anything at all after the close of a valid geometry seems to be OK as long as it's not a WKB token:
But if you put in a token, nope: