aboutsummaryrefslogtreecommitdiff
path: root/src/projections/omerc.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@mines-paris.org>2019-04-11 12:45:33 +0200
committerGitHub <noreply@github.com>2019-04-11 12:45:33 +0200
commit2117c151d62cd0267068075b9e7cf7cc0d404a63 (patch)
treeb90bd6f8e54a2f983d1937622de467c80ed49357 /src/projections/omerc.cpp
parentfb125618fd18f112ed6f37662b021d07a602ff90 (diff)
parentc1e730312965831e6b9c2093677a67716c198622 (diff)
downloadPROJ-2117c151d62cd0267068075b9e7cf7cc0d404a63.tar.gz
PROJ-2117c151d62cd0267068075b9e7cf7cc0d404a63.zip
Merge pull request #1422 from rouault/fix_ossfuzz_14135_and_al
Fix ossfuzz 14135, 14136 and 14138
Diffstat (limited to 'src/projections/omerc.cpp')
-rw-r--r--src/projections/omerc.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/projections/omerc.cpp b/src/projections/omerc.cpp
index c33f6489..c0278043 100644
--- a/src/projections/omerc.cpp
+++ b/src/projections/omerc.cpp
@@ -191,6 +191,9 @@ PJ *PROJECTION(omerc) {
gamma = alpha_c;
} else
alpha_c = aasin(P->ctx, D*sin(gamma0 = gamma));
+ if( fabs(fabs(P->phi0) - M_HALFPI) <= TOL ) {
+ return pj_default_destructor(P, PJD_ERR_LAT_0_OR_ALPHA_EQ_90);
+ }
P->lam0 = lamc - aasin(P->ctx, .5 * (F - 1. / F) *
tan(gamma0)) / Q->B;
} else {
@@ -206,8 +209,11 @@ PJ *PROJECTION(omerc) {
lam2 += M_TWOPI;
P->lam0 = adjlon(.5 * (lam1 + lam2) - atan(
J * tan(.5 * Q->B * (lam1 - lam2)) / p) / Q->B);
- gamma0 = atan(2. * sin(Q->B * adjlon(lam1 - P->lam0)) /
- (F - 1. / F));
+ const double denom = F - 1. / F;
+ if( denom == 0 ) {
+ return pj_default_destructor(P, PJD_ERR_INVALID_ECCENTRICITY);
+ }
+ gamma0 = atan(2. * sin(Q->B * adjlon(lam1 - P->lam0)) / denom);
gamma = alpha_c = aasin(P->ctx, D * sin(gamma0));
}
Q->singam = sin(gamma0);