aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2019-03-24 20:49:01 +0100
committerGitHub <noreply@github.com>2019-03-24 20:49:01 +0100
commit72f7dbb778e3e9311f48a5a902ff9dafc49bac9f (patch)
tree21d82344d16b3f5386dc9a45ed2e99bc1264e4f0
parent3e37b354194b4d42acd247c32ca97e45ac40af1e (diff)
parent8f22c17b2ef9c1e216a1da0206acea41587f67ce (diff)
downloadPROJ-72f7dbb778e3e9311f48a5a902ff9dafc49bac9f.tar.gz
PROJ-72f7dbb778e3e9311f48a5a902ff9dafc49bac9f.zip
Merge pull request #1358 from rouault/fix_ossfuzz_13891
Fix ossfuzz 13891
-rw-r--r--src/projections/urm5.cpp6
-rw-r--r--src/strerrno.cpp4
-rw-r--r--test/gie/builtins.gie4
3 files changed, 10 insertions, 4 deletions
diff --git a/src/projections/urm5.cpp b/src/projections/urm5.cpp
index a93293c0..f89bb1d5 100644
--- a/src/projections/urm5.cpp
+++ b/src/projections/urm5.cpp
@@ -45,7 +45,11 @@ PJ *PROJECTION(urm5) {
Q->q3 = pj_param(P->ctx, P->params, "dq").f / 3.;
alpha = pj_param(P->ctx, P->params, "ralpha").f;
t = Q->n * sin (alpha);
- Q->m = cos (alpha) / sqrt (1. - t * t);
+ const double denom = sqrt (1. - t * t);
+ if( denom == 0 ) {
+ return pj_default_destructor(P, PJD_ERR_LAT_0_OR_ALPHA_EQ_90);
+ }
+ Q->m = cos (alpha) / denom;
Q->rmn = 1. / (Q->m * Q->n);
P->es = 0.;
diff --git a/src/strerrno.cpp b/src/strerrno.cpp
index a9310a55..20255747 100644
--- a/src/strerrno.cpp
+++ b/src/strerrno.cpp
@@ -40,8 +40,8 @@ pj_err_list[] = {
"path not in range", /* -29 */
"h <= 0", /* -30 */
"k <= 0", /* -31 */
- "lat_0 = 0 or 90 or alpha = 90", /* -32 */
- "lat_1=lat_2 or lat_1=0 or lat_2=90", /* -33 */
+ "lat_1=lat_2 or lat_1=0 or lat_2=90", /* -32 */
+ "lat_0 = 0 or 90 or alpha = 90", /* -33 */
"elliptical usage required", /* -34 */
"invalid UTM zone number", /* -35 */
"", /* no longer used */ /* -36 */
diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie
index 97009cff..bb5379fe 100644
--- a/test/gie/builtins.gie
+++ b/test/gie/builtins.gie
@@ -5253,7 +5253,7 @@ Urmaev V
===============================================================================
-------------------------------------------------------------------------------
-operation +proj=urm5 +a=6400000 +lat_1=0.5 +lat_2=2 +n=0.5
+operation +proj=urm5 +a=6400000 +n=0.5
-------------------------------------------------------------------------------
tolerance 0.1 mm
accept 2 1
@@ -5265,6 +5265,8 @@ expect -223393.638433964 111696.818785117
accept -2 -1
expect -223393.638433964 -111696.818785117
+operation +proj=urm5 +a=6400000 +n=1 +alpha=90
+expect failure errno lat_0_or_alpha_eq_90
===============================================================================
Urmaev Flat-Polar Sinusoidal