aboutsummaryrefslogtreecommitdiff
path: root/src/gauss.cpp
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2019-03-17 08:10:20 +0100
committerGitHub <noreply@github.com>2019-03-17 08:10:20 +0100
commitbf609ea9ae605d3cf3ce76307f92712b75f01e47 (patch)
treef03df01ad362004340826a19c5d28d3b317792b7 /src/gauss.cpp
parenteab22791b80615e3ad77040423f70205cd7a061d (diff)
parentc6f41f0176d744de5de1ca48e764148ed18e6489 (diff)
downloadPROJ-bf609ea9ae605d3cf3ce76307f92712b75f01e47.tar.gz
PROJ-bf609ea9ae605d3cf3ce76307f92712b75f01e47.zip
Merge pull request #1322 from rouault/ossfuzz_fixes
Various ossfuzz fixes
Diffstat (limited to 'src/gauss.cpp')
-rw-r--r--src/gauss.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gauss.cpp b/src/gauss.cpp
index b7a27191..49ccfa1c 100644
--- a/src/gauss.cpp
+++ b/src/gauss.cpp
@@ -65,9 +65,14 @@ void *pj_gauss_ini(double e, double phi0, double *chi, double *rc) {
}
*chi = asin(sphi / en->C);
en->ratexp = 0.5 * en->C * e;
- en->K = tan(.5 * *chi + M_FORTPI) / (
- pow(tan(.5 * phi0 + M_FORTPI), en->C) *
- srat(en->e * sphi, en->ratexp) );
+ if( .5 * phi0 + M_FORTPI < 1e-10 ) {
+ en->K = 1.0 / srat(en->e * sphi, en->ratexp);
+ }
+ else {
+ en->K = tan(.5 * *chi + M_FORTPI) / (
+ pow(tan(.5 * phi0 + M_FORTPI), en->C) *
+ srat(en->e * sphi, en->ratexp) );
+ }
return ((void *)en);
}