From 81ee400af413e4b2449213d269c1422b8611e3aa Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 20 Mar 2019 18:25:46 +0100 Subject: 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 --- src/ell_set.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ell_set.cpp') 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 */ -- cgit v1.2.3