Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix pointsFromWKT to accept only number
  • Loading branch information
lbartoletti committed Aug 24, 2020
1 parent 00b51a1 commit 74984c1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/geometry/qgsgeometryutils.cpp
Expand Up @@ -1109,6 +1109,12 @@ QgsPointSequence QgsGeometryUtils::pointsFromWKT( const QString &wktCoordinateLi
for ( const QString &pointCoordinates : coordList )
{
QStringList coordinates = pointCoordinates.split( rx, QString::SkipEmptyParts );

// exit with an empty set if one list contains invalid value.
QRegularExpression rxIsNumber( QStringLiteral( "^[+-]?(\\d\\.?\\d*[Ee][+\\-]?\\d+|(\\d+\\.\\d*|\\d*\\.\\d+)|\\d+)$" ) );
if ( coordinates.filter( rxIsNumber ).size() != coordinates.size() )
return points;

if ( coordinates.size() == 3 && !foundZ && !foundM && !is3D && !isMeasure )
{
// 3 dimensional coordinates, but not specifically marked as such. We allow this
Expand Down

0 comments on commit 74984c1

Please sign in to comment.