aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2021-04-16 08:31:50 +0200
committerGitHub <noreply@github.com>2021-04-16 08:31:50 +0200
commitcedc9789a1bd93e7ce919f99ed8914a9dd18b2a5 (patch)
treef3c2672f50650c2769bdf09a3b1f970756125ce2
parente03a9aacec01aa8082304c192f34fd26b95a5e11 (diff)
parente4d0c40f8247214bc0069fc6eafc13122464e413 (diff)
downloadPROJ-cedc9789a1bd93e7ce919f99ed8914a9dd18b2a5.tar.gz
PROJ-cedc9789a1bd93e7ce919f99ed8914a9dd18b2a5.zip
Merge pull request #2673 from OSGeo/backport-2672-to-8.0
[Backport 8.0] utm: error out when value of +zone= is not an integer (fixes #2671)
-rw-r--r--src/param.cpp8
-rw-r--r--test/gie/builtins.gie6
2 files changed, 14 insertions, 0 deletions
diff --git a/src/param.cpp b/src/param.cpp
index a716f9b9..21afc57f 100644
--- a/src/param.cpp
+++ b/src/param.cpp
@@ -201,6 +201,14 @@ PROJVALUE pj_param (PJ_CONTEXT *ctx, paralist *pl, const char *opt) {
switch (type) {
case 'i': /* integer input */
value.i = atoi(opt);
+ for( const char* ptr = opt; *ptr != '\0'; ++ptr )
+ {
+ if( !(*ptr >= '0' && *ptr <= '9') )
+ {
+ proj_context_errno_set (ctx, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE);
+ value.i = 0;
+ }
+ }
break;
case 'd': /* simple real input */
value.f = pj_atof(opt);
diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie
index b3c84f74..49627874 100644
--- a/test/gie/builtins.gie
+++ b/test/gie/builtins.gie
@@ -6389,6 +6389,12 @@ operation +proj=utm +a=6400000 +zone=30
# utm not possible on sphere
expect failure errno invalid_op_illegal_arg_value
+-------------------------------------------------------------------------------
+# Test that we error out when the UTM zone is not an integer (#2671)
+-------------------------------------------------------------------------------
+operation +proj=utm +zone=11ooops +ellps=WGS84
+expect failure errno invalid_op_illegal_arg_value
+
===============================================================================
# van der Grinten (I)
# Misc Sph