Bug #77244 GEOMETRY CONSTRUCTION FUNCTIONS ALLOWS INVALID WKT
Submitted: 4 Jun 2015 6:40 Modified: 18 Jun 2015 14:22
Reporter: Erik Frøseth Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: GIS Severity:S3 (Non-critical)
Version:5.7.7 OS:Any
Assigned to: CPU Architecture:Any

[4 Jun 2015 6:40] Erik Frøseth
Description:
The geometry construction functions accepts WKT strings with random garbage at the end. Such strings are not valid WKT representation, and should be rejected.

How to repeat:
SELECT ST_AsText(ST_GeomFromText("POINT(10 11) POINT(11 12)"));

SELECT ST_AsText(ST_PointFromText("POINT(10 11) POINT(11 12)"));

SELECT ST_AsText(ST_GeomFromText("MULTIPOINT(10 11, 12 13), 14 15"));

SELECT ST_AsText(ST_GeomFromText("POINT(10 11)FOOBAR"));

Suggested fix:
Reject invalid WKT strings with garbage at the end.
[18 Jun 2015 14:22] Paul Dubois
Noted in 5.7.8, 5.8.0 changelogs.

Geometry construcutor functions that take WKT or WKB values (such as
ST_GeomFromText() and ST_GeomFromWKB()) did not check for trailing
garbage bytes. They now reject trailing nonwhitespace characters and
produce an error.