diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-04-26 18:09:04 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-04-26 18:09:04 +0200 |
| commit | 210df01d861f4d75b3e4c698b9394d6d48989169 (patch) | |
| tree | 16be32ec47dad5bee7abd33d9197cac5aee9b6ec /src/projections/aitoff.cpp | |
| parent | c783e556835d2a4be85a20ee62bea8b13de3b841 (diff) | |
| download | PROJ-210df01d861f4d75b3e4c698b9394d6d48989169.tar.gz PROJ-210df01d861f4d75b3e4c698b9394d6d48989169.zip | |
aitof: fix division by zero
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14447
Credit to OSS Fuzz
Diffstat (limited to 'src/projections/aitoff.cpp')
| -rw-r--r-- | src/projections/aitoff.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/projections/aitoff.cpp b/src/projections/aitoff.cpp index 639eeb87..23554605 100644 --- a/src/projections/aitoff.cpp +++ b/src/projections/aitoff.cpp @@ -117,7 +117,12 @@ static PJ_LP s_inverse (PJ_XY xy, PJ *P) { /* Spheroidal, inverse */ sp = sin(lp.phi); cp = cos(lp.phi); D = cp * cl; C = 1. - D * D; - D = acos(D) / pow(C, 1.5); + const double denom = pow(C, 1.5); + if( denom == 0 ) { + proj_errno_set(P, PJD_ERR_NON_CONVERGENT); + return lp; + } + D = acos(D) / denom; f1 = 2. * D * C * cp * sl; f2 = D * C * sp; f1p = 2.* (sl * cl * sp * cp / C - D * sp * sl); |
