From 00dffd7ace356d7cb39e2c515237d4351f5b5666 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 11 Apr 2019 00:14:26 +0200 Subject: omerc: avoid division by zero when |lat_0|=90 Partially revert e3346bb39c860883ed9a8ada0657139118e21ef0 (#195) Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14136 Credit to OSS Fuzz --- src/projections/omerc.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/projections/omerc.cpp') diff --git a/src/projections/omerc.cpp b/src/projections/omerc.cpp index c33f6489..4d78fbef 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 { -- cgit v1.2.3