From 91d23e65ace9872a785f66db756d77e01381556f Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 17 Sep 2019 19:53:13 +0200 Subject: eqdc: avoid potential division by zero. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17190 --- src/projections/eqdc.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/projections') 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; } -- cgit v1.2.3 From 81cb8511161a1f6e03deea064a49a10bf10801e4 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 17 Sep 2019 20:45:06 +0200 Subject: geos: avoid division by zero. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14666 --- src/projections/geos.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/projections') 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.*/ -- cgit v1.2.3 From 15a85172b778c3d57adb0e4e61842c0a4bcb4e44 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 17 Sep 2019 21:08:41 +0200 Subject: isea: avoid undefined behaviour on left shift of negative value. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15009 --- src/projections/isea.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/projections') 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; -- cgit v1.2.3 From 216cf0c26c7e63084f30d9eea03c4f36ae3afcad Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 17 Sep 2019 21:34:46 +0200 Subject: aea_e_inverse(): avoid calling asin() with invalid argument which results in NaN being propagated. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15336 --- src/projections/aea.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/projections') 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; -- cgit v1.2.3