aboutsummaryrefslogtreecommitdiff
path: root/src/projections
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-09-18 16:57:19 +0200
committerGitHub <noreply@github.com>2019-09-18 16:57:19 +0200
commit72203ca68e123a237c8c748d39131b702ea4b646 (patch)
tree38d1214e399eaaf4e173ad5d13a3820364065c1d /src/projections
parentd2f661fc99615a33d72bb0120a14bca2aaced221 (diff)
parentbc53524cfbde95ecf6bb134984e68eb715d11c2b (diff)
downloadPROJ-72203ca68e123a237c8c748d39131b702ea4b646.tar.gz
PROJ-72203ca68e123a237c8c748d39131b702ea4b646.zip
Merge pull request #1620 from rouault/ossfuzz_17190_and_others
Assorted set of fixes for boring oss-fuzz related errors (mostly divisions by zero in odd situations)
Diffstat (limited to 'src/projections')
-rw-r--r--src/projections/aea.cpp4
-rw-r--r--src/projections/eqdc.cpp2
-rw-r--r--src/projections/geos.cpp8
-rw-r--r--src/projections/isea.cpp2
4 files changed, 11 insertions, 5 deletions
diff --git a/src/projections/aea.cpp b/src/projections/aea.cpp
index 721ea3c9..d607c95a 100644
--- a/src/projections/aea.cpp
+++ b/src/projections/aea.cpp
@@ -127,6 +127,10 @@ static PJ_LP aea_e_inverse (PJ_XY xy, PJ *P) { /* Ellipsoid/spheroid, inverse
if (Q->ellips) {
lp.phi = (Q->c - lp.phi * lp.phi) / Q->n;
if (fabs(Q->ec - fabs(lp.phi)) > TOL7) {
+ if (fabs(lp.phi) > 2 ) {
+ proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION);
+ return lp;
+ }
if ((lp.phi = phi1_(lp.phi, P->e, P->one_es)) == HUGE_VAL) {
proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION);
return lp;
diff --git a/src/projections/eqdc.cpp b/src/projections/eqdc.cpp
index e050a593..00aacfda 100644
--- a/src/projections/eqdc.cpp
+++ b/src/projections/eqdc.cpp
@@ -117,6 +117,8 @@ PJ *PROJECTION(eqdc) {
} else {
if (secant)
Q->n = (cosphi - cos(Q->phi2)) / (Q->phi2 - Q->phi1);
+ if (Q->n == 0)
+ return destructor (P, PJD_ERR_CONIC_LAT_EQUAL);
Q->c = Q->phi1 + cos(Q->phi1) / Q->n;
Q->rho0 = Q->c - P->phi0;
}
diff --git a/src/projections/geos.cpp b/src/projections/geos.cpp
index 15f51e6f..7999b21f 100644
--- a/src/projections/geos.cpp
+++ b/src/projections/geos.cpp
@@ -126,11 +126,11 @@ static PJ_LP geos_s_inverse (PJ_XY xy, PJ *P) { /* Spheroidal, inverse
/* Setting three components of vector from satellite to position.*/
Vx = -1.0;
if(Q->flip_axis) {
- Vz = tan (xy.y / (Q->radius_g - 1.0));
- Vy = tan (xy.x / (Q->radius_g - 1.0)) * sqrt (1.0 + Vz * Vz);
+ Vz = tan (xy.y / Q->radius_g_1);
+ Vy = tan (xy.x / Q->radius_g_1) * sqrt (1.0 + Vz * Vz);
} else {
- Vy = tan (xy.x / (Q->radius_g - 1.0));
- Vz = tan (xy.y / (Q->radius_g - 1.0)) * sqrt (1.0 + Vy * Vy);
+ Vy = tan (xy.x / Q->radius_g_1);
+ Vz = tan (xy.y / Q->radius_g_1) * sqrt (1.0 + Vy * Vy);
}
/* Calculation of terms in cubic equation and determinant.*/
diff --git a/src/projections/isea.cpp b/src/projections/isea.cpp
index c22e143d..d1aeab4a 100644
--- a/src/projections/isea.cpp
+++ b/src/projections/isea.cpp
@@ -902,7 +902,7 @@ static int isea_hex(struct isea_dgg *g, int tri,
{
throw "Invalid shift";
}
- hex->x = ((int)v.x << 4) + quad;
+ hex->x = ((int)v.x * 16) + quad;
hex->y = v.y;
return 1;