diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-03-20 18:25:46 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-03-20 18:25:46 +0100 |
| commit | 81ee400af413e4b2449213d269c1422b8611e3aa (patch) | |
| tree | 9ad751dc969e6cebeff5ceb1ff6b14ec9638760e /src/ell_set.cpp | |
| parent | 61166380276a0e99b980dfdc6b43ea4656846c08 (diff) | |
| download | PROJ-81ee400af413e4b2449213d269c1422b8611e3aa.tar.gz PROJ-81ee400af413e4b2449213d269c1422b8611e3aa.zip | |
pj_calc_ellipsoid_params(): reject f=1
To avoid division by zero of b.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13830
Credit to OSS Fuzz
Diffstat (limited to 'src/ell_set.cpp')
| -rw-r--r-- | src/ell_set.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ell_set.cpp b/src/ell_set.cpp index 386b4f46..d0714bee 100644 --- a/src/ell_set.cpp +++ b/src/ell_set.cpp @@ -542,6 +542,10 @@ int pj_calc_ellipsoid_params (PJ *P, double a, double es) { /* flattening */ if (0==P->f) P->f = 1 - cos (P->alpha); /* = 1 - sqrt (1 - PIN->es); */ + if (P->f == 1.0) { + pj_ctx_set_errno( P->ctx, PJD_ERR_ECCENTRICITY_IS_ONE_OR_GREATER); + return PJD_ERR_ECCENTRICITY_IS_ONE_OR_GREATER; + } P->rf = P->f != 0.0 ? 1.0/P->f: HUGE_VAL; /* second flattening */ |
