diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-04-15 21:07:49 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2021-04-15 21:07:49 +0200 |
| commit | 773583b448710ffec5ffd7ae653374e32299c144 (patch) | |
| tree | 7ddd1b4827fa739a90d1ab3f9e004030479bc1cf | |
| parent | a850aac5e0de3f86f2e4cf29f211e88744db5133 (diff) | |
| download | PROJ-773583b448710ffec5ffd7ae653374e32299c144.tar.gz PROJ-773583b448710ffec5ffd7ae653374e32299c144.zip | |
utm: error out when value of +zone= is not an integer (fixes #2671)
| -rw-r--r-- | src/param.cpp | 8 | ||||
| -rw-r--r-- | test/gie/builtins.gie | 6 |
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 8c0cf6d2..1f3824c8 100644 --- a/test/gie/builtins.gie +++ b/test/gie/builtins.gie @@ -6402,6 +6402,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 |
