aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-03-15 20:04:15 +0100
committerEven Rouault <even.rouault@spatialys.com>2019-03-16 10:10:02 +0100
commit7dd1a2ee6bfb33807594f115c59548f8cf1d3475 (patch)
treeb7abd955a652d7ebf34a879195347d195e529feb
parent3cce54767afe77412b850d2d88ee168370570b6f (diff)
downloadPROJ-7dd1a2ee6bfb33807594f115c59548f8cf1d3475.tar.gz
PROJ-7dd1a2ee6bfb33807594f115c59548f8cf1d3475.zip
aea: validate |lat_1| and |lat_2| <= 90
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13028 Credit to OSS Fuzz
-rw-r--r--src/projections/aea.cpp2
-rw-r--r--src/strerrno.cpp2
-rw-r--r--test/gie/builtins.gie5
3 files changed, 8 insertions, 1 deletions
diff --git a/src/projections/aea.cpp b/src/projections/aea.cpp
index 9a0c4656..f457e836 100644
--- a/src/projections/aea.cpp
+++ b/src/projections/aea.cpp
@@ -155,6 +155,8 @@ static PJ *setup(PJ *P) {
P->inv = e_inverse;
P->fwd = e_forward;
+ if (fabs(Q->phi1) > M_HALFPI || fabs(Q->phi2) > M_HALFPI)
+ return destructor(P, PJD_ERR_LAT_LARGER_THAN_90);
if (fabs(Q->phi1 + Q->phi2) < EPS10)
return destructor(P, PJD_ERR_CONIC_LAT_EQUAL);
Q->n = sinphi = sin(Q->phi1);
diff --git a/src/strerrno.cpp b/src/strerrno.cpp
index 5dedef98..a9310a55 100644
--- a/src/strerrno.cpp
+++ b/src/strerrno.cpp
@@ -30,7 +30,7 @@ pj_err_list[] = {
"acos/asin: |arg| >1.+1e-14", /* -19 */
"tolerance condition error", /* -20 */
"conic lat_1 = -lat_2", /* -21 */
- "lat_1 >= 90", /* -22 */
+ "lat_0, lat_1 or lat_2 >= 90", /* -22 */
"lat_1 = 0", /* -23 */
"lat_ts >= 90", /* -24 */
"no distance between control points", /* -25 */
diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie
index 15bbaf05..c4f849a4 100644
--- a/test/gie/builtins.gie
+++ b/test/gie/builtins.gie
@@ -63,6 +63,11 @@ expect -0.001790494 0.000895246
accept -200 -100
expect -0.001790493 -0.000895247
+operation +proj=aea +ellps=GRS80 +lat_1=900
+expect failure errno lat_larger_than_90
+
+operation +proj=aea +ellps=GRS80 +lat_2=900
+expect failure errno lat_larger_than_90
===============================================================================
Azimuthal Equidistant