Skip to content

Commit

Permalink
Merge pull request #1340 from rouault/fix_ossfuzz_13827
Browse files Browse the repository at this point in the history
aea: avoid division by zero
  • Loading branch information
rouault committed Mar 21, 2019
2 parents 5d74522 + ab19f0d commit bf14355
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/projections/aea.cpp
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions test/gie/builtins.gie
Expand Up @@ -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
Expand Down

0 comments on commit bf14355

Please sign in to comment.