aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@mines-paris.org>2019-03-21 13:53:01 +0100
committerGitHub <noreply@github.com>2019-03-21 13:53:01 +0100
commitbf14355080cf7d8cf7e4b3342263ae7f22660e58 (patch)
treed73eba3ecb0347d7131b25527aa496351c8434a1
parent5d74522573291a8af698acf3102a662eb3a675eb (diff)
parentab19f0d7aec223b89537d07d5f5f3f2e1f5db822 (diff)
downloadPROJ-bf14355080cf7d8cf7e4b3342263ae7f22660e58.tar.gz
PROJ-bf14355080cf7d8cf7e4b3342263ae7f22660e58.zip
Merge pull request #1340 from rouault/fix_ossfuzz_13827
aea: avoid division by zero
-rw-r--r--src/projections/aea.cpp4
-rw-r--r--test/gie/builtins.gie5
2 files changed, 9 insertions, 0 deletions
diff --git a/src/projections/aea.cpp b/src/projections/aea.cpp
index f457e836..8a80c49c 100644
--- a/src/projections/aea.cpp
+++ b/src/projections/aea.cpp
@@ -180,6 +180,10 @@ static PJ *setup(PJ *P) {
return destructor(P, 0);
Q->n = (m1 * m1 - m2 * m2) / (ml2 - ml1);
+ if (Q->n == 0) {
+ // Not quite, but es is very close to 1...
+ return destructor(P, PJD_ERR_ECCENTRICITY_IS_ONE_OR_GREATER);
+ }
}
Q->ec = 1. - .5 * P->one_es * log((1. - P->e) /
(1. + P->e)) / P->e;
diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie
index 56724782..97009cff 100644
--- a/test/gie/builtins.gie
+++ b/test/gie/builtins.gie
@@ -69,6 +69,11 @@ expect failure errno lat_larger_than_90
operation +proj=aea +ellps=GRS80 +lat_2=900
expect failure errno lat_larger_than_90
+-------------------------------------------------------------------------------
+operation +proj=aea +a=9999999 +b=.9 +lat_2=1
+-------------------------------------------------------------------------
+expect failure errno eccentricity_is_one
+
===============================================================================
Azimuthal Equidistant
Azi, Sph&Ell