diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-09-17 21:48:46 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-09-17 21:48:46 +0200 |
| commit | bc53524cfbde95ecf6bb134984e68eb715d11c2b (patch) | |
| tree | 38d1214e399eaaf4e173ad5d13a3820364065c1d | |
| parent | 8e76c61082c5c74d1e29d5d850b2cdd09ab35ba8 (diff) | |
| download | PROJ-bc53524cfbde95ecf6bb134984e68eb715d11c2b.tar.gz PROJ-bc53524cfbde95ecf6bb134984e68eb715d11c2b.zip | |
ell_set.cpp: avoid division by zero in R_lat_a case. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16130
| -rw-r--r-- | src/ell_set.cpp | 3 | ||||
| -rw-r--r-- | test/gie/ellipsoid.gie | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/ell_set.cpp b/src/ell_set.cpp index 0d7fb6d5..d2930ca4 100644 --- a/src/ell_set.cpp +++ b/src/ell_set.cpp @@ -389,6 +389,9 @@ static int ellps_spherification (PJ *P) { return proj_errno_set (P, PJD_ERR_REF_RAD_LARGER_THAN_90); t = sin (t); t = 1 - P->es * t * t; + if (t == 0.) { + return proj_errno_set(P, PJD_ERR_INVALID_ECCENTRICITY); + } if (i==5) /* arithmetic */ P->a *= (1. - P->es + t) / (2 * t * sqrt(t)); else /* geometric */ diff --git a/test/gie/ellipsoid.gie b/test/gie/ellipsoid.gie index b84a512f..74fbe31d 100644 --- a/test/gie/ellipsoid.gie +++ b/test/gie/ellipsoid.gie @@ -116,6 +116,8 @@ accept 12 55 expect 1338073.2696101593 7374207.4801437631 ------------------------------------------------------------------------------- +operation proj=merc a=1E77 R_lat_a=90 b=1 +expect failure errno invalid_eccentricity ------------------------------------------------------------------------------- This one from testvarious failed at first version of the pull request |
