[postgis-tickets] r17130 - Tighter parsing of WKT
Paul Ramsey
pramsey at cleverelephant.ca
Wed Jan 9 12:34:17 PST 2019
Author: pramsey
Date: 2019-01-09 12:34:17 -0800 (Wed, 09 Jan 2019)
New Revision: 17130
Modified:
branches/2.4/NEWS
branches/2.4/liblwgeom/cunit/cu_in_wkt.c
branches/2.4/liblwgeom/cunit/cu_out_x3d.c
branches/2.4/liblwgeom/lwin_wkt_parse.c
branches/2.4/postgis/lwgeom_ogc.c
Log:
Tighter parsing of WKT
References #4273
Modified: branches/2.4/NEWS
===================================================================
--- branches/2.4/NEWS 2019-01-09 20:09:19 UTC (rev 17129)
+++ branches/2.4/NEWS 2019-01-09 20:34:17 UTC (rev 17130)
@@ -7,6 +7,7 @@
WARNING: REINDEX your ND index on tables that have records with different M/Z
dimensions for &&& operator to work predictably.
(Darafei Praliaskouski, Arthur Lesuisse, Andrew Gierth, Raúl Marín)
+ - #4273, Tighter parsing of WKT (Paul Ramsey)
- #4267, Enable Proj 6 deprecated APIs (Darafei Praliaskouski, Raúl Marín)
Modified: branches/2.4/liblwgeom/cunit/cu_in_wkt.c
===================================================================
--- branches/2.4/liblwgeom/cunit/cu_in_wkt.c 2019-01-09 20:09:19 UTC (rev 17129)
+++ branches/2.4/liblwgeom/cunit/cu_in_wkt.c 2019-01-09 20:34:17 UTC (rev 17130)
@@ -67,6 +67,11 @@
static void test_wkt_in_point(void)
{
+ s = "POINT(1 2) foobar";
+ r = cu_wkt_in(s, WKT_SFSQL);
+ CU_ASSERT_STRING_EQUAL("parse error - invalid geometry", r);
+ lwfree(r);
+
s = "POINT(1e700 0)";
r = cu_wkt_in(s, WKT_SFSQL);
CU_TEST ( ! strcmp(r, "POINT(inf 0)") || ! strcmp(r, "POINT(1.#INF 0)") || ! strcmp(r, "POINT(Infinity 0)") );
Modified: branches/2.4/liblwgeom/cunit/cu_out_x3d.c
===================================================================
--- branches/2.4/liblwgeom/cunit/cu_out_x3d.c 2019-01-09 20:09:19 UTC (rev 17129)
+++ branches/2.4/liblwgeom/cunit/cu_out_x3d.c 2019-01-09 20:34:17 UTC (rev 17130)
@@ -77,7 +77,7 @@
/* huge data */
do_x3d3_test(
- "POINT(1E300 -105E-153 4E300)'",
+ "POINT(1E300 -105E-153 4E300)",
"1e+300 -0 4e+300",
NULL, 0, 0);
}
Modified: branches/2.4/liblwgeom/lwin_wkt_parse.c
===================================================================
--- branches/2.4/liblwgeom/lwin_wkt_parse.c 2019-01-09 20:09:19 UTC (rev 17129)
+++ branches/2.4/liblwgeom/lwin_wkt_parse.c 2019-01-09 20:34:17 UTC (rev 17130)
@@ -167,7 +167,7 @@
wkt_lexer_close(); /* Clean up lexer */
/* A non-zero parser return is an error. */
- if ( parse_rv != 0 )
+ if ( parse_rv || global_parser_result.errcode )
{
if( ! global_parser_result.errcode )
{
Modified: branches/2.4/postgis/lwgeom_ogc.c
===================================================================
--- branches/2.4/postgis/lwgeom_ogc.c 2019-01-09 20:09:19 UTC (rev 17129)
+++ branches/2.4/postgis/lwgeom_ogc.c 2019-01-09 20:34:17 UTC (rev 17130)
@@ -792,7 +792,7 @@
POSTGIS_DEBUG(2, "LWGEOM_from_text");
POSTGIS_DEBUGF(3, "wkt: [%s]", wkt);
- if (lwgeom_parse_wkt(&lwg_parser_result, wkt, LW_PARSER_CHECK_ALL) == LW_FAILURE)
+ if (lwgeom_parse_wkt(&lwg_parser_result, wkt, LW_PARSER_CHECK_ALL) == LW_FAILURE )
PG_PARSER_ERROR(lwg_parser_result);
lwgeom = lwg_parser_result.geom;
More information about the postgis-tickets
mailing list