diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-04-11 00:14:26 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-04-11 00:14:26 +0200 |
| commit | 00dffd7ace356d7cb39e2c515237d4351f5b5666 (patch) | |
| tree | 8181bae35377a82c549c2a25476267eaafd14bc0 | |
| parent | 685ad56156f320760c92f7f71fa4acbf3e00acc9 (diff) | |
| download | PROJ-00dffd7ace356d7cb39e2c515237d4351f5b5666.tar.gz PROJ-00dffd7ace356d7cb39e2c515237d4351f5b5666.zip | |
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
| -rw-r--r-- | src/projections/omerc.cpp | 3 | ||||
| -rw-r--r-- | test/gie/builtins.gie | 5 |
2 files changed, 8 insertions, 0 deletions
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 { diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie index adaa98d9..bbaca7ba 100644 --- a/test/gie/builtins.gie +++ b/test/gie/builtins.gie @@ -3962,6 +3962,11 @@ tolerance 1 mm accept 2 1 expect -3569.825230822232 -5093592.310871849768 +------------------------------------------------------------------------------- +operation +proj=omerc +R=1 +alpha=0 +lat_0=90 +------------------------------------------------------------------------------- +expect failure errno lat_0_or_alpha_eq_90 + =============================================================================== Ortelius Oval |
