[postgis-tickets] r17127 - Tighten up parsing to account for strings
Paul Ramsey
pramsey at cleverelephant.ca
Wed Jan 9 08:42:24 PST 2019
Author: pramsey
Date: 2019-01-09 08:42:23 -0800 (Wed, 09 Jan 2019)
New Revision: 17127
Modified:
trunk/postgis/lwgeom_inout.c
trunk/postgis/lwgeom_ogc.c
Log:
Tighten up parsing to account for strings
with junk after valid geometry
References #4273
Modified: trunk/postgis/lwgeom_inout.c
===================================================================
--- trunk/postgis/lwgeom_inout.c 2019-01-08 16:48:53 UTC (rev 17126)
+++ trunk/postgis/lwgeom_inout.c 2019-01-09 16:42:23 UTC (rev 17127)
@@ -143,7 +143,8 @@
/* WKT then. */
else
{
- if ( lwgeom_parse_wkt(&lwg_parser_result, str, LW_PARSER_CHECK_ALL) == LW_FAILURE )
+ int rv = lwgeom_parse_wkt(&lwg_parser_result, str, LW_PARSER_CHECK_ALL);
+ if ( rv == LW_FAILURE || lwg_parser_result.errcode )
{
PG_PARSER_ERROR(lwg_parser_result);
PG_RETURN_NULL();
Modified: trunk/postgis/lwgeom_ogc.c
===================================================================
--- trunk/postgis/lwgeom_ogc.c 2019-01-08 16:48:53 UTC (rev 17126)
+++ trunk/postgis/lwgeom_ogc.c 2019-01-09 16:42:23 UTC (rev 17127)
@@ -788,11 +788,13 @@
LWGEOM_PARSER_RESULT lwg_parser_result;
GSERIALIZED *geom_result = NULL;
LWGEOM *lwgeom;
+ int rv;
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)
+ rv = lwgeom_parse_wkt(&lwg_parser_result, wkt, LW_PARSER_CHECK_ALL);
+ if (rv == LW_FAILURE || lwg_parser_result.errcode)
PG_PARSER_ERROR(lwg_parser_result);
lwgeom = lwg_parser_result.geom;
More information about the postgis-tickets
mailing list