aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-03-21 09:54:04 +0100
committerEven Rouault <even.rouault@spatialys.com>2019-03-21 12:49:31 +0100
commitab19f0d7aec223b89537d07d5f5f3f2e1f5db822 (patch)
treed73eba3ecb0347d7131b25527aa496351c8434a1 /src
parent5d74522573291a8af698acf3102a662eb3a675eb (diff)
downloadPROJ-ab19f0d7aec223b89537d07d5f5f3f2e1f5db822.tar.gz
PROJ-ab19f0d7aec223b89537d07d5f5f3f2e1f5db822.zip
aea: avoid division by zero
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13827 Credit to OSS Fuzz
Diffstat (limited to 'src')
-rw-r--r--src/projections/aea.cpp4
1 files changed, 4 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;