aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@mines-paris.org>2019-04-20 19:27:35 +0200
committerGitHub <noreply@github.com>2019-04-20 19:27:35 +0200
commit55dba69f0edfad8d5950eeb8870d5b23eb0af12d (patch)
tree8e58eb1247f7b7fafd105a3e191fbe23466a8b18
parent5d6945e76ba83af90bc94501f79fc0c51011c724 (diff)
parent318dab0d074a7bfd9d0724e674777aa10422d4e6 (diff)
downloadPROJ-55dba69f0edfad8d5950eeb8870d5b23eb0af12d.tar.gz
PROJ-55dba69f0edfad8d5950eeb8870d5b23eb0af12d.zip
Merge pull request #1436 from rouault/ossfuzz_14384
omerc: validate lat_1 and lat_2 to avoid divison by zero
-rw-r--r--src/projections/omerc.cpp2
-rw-r--r--test/gie/builtins.gie10
2 files changed, 12 insertions, 0 deletions
diff --git a/src/projections/omerc.cpp b/src/projections/omerc.cpp
index e07c209e..0de3aa7d 100644
--- a/src/projections/omerc.cpp
+++ b/src/projections/omerc.cpp
@@ -154,6 +154,8 @@ PJ *PROJECTION(omerc) {
phi1 = pj_param(P->ctx, P->params, "rlat_1").f;
lam2 = pj_param(P->ctx, P->params, "rlon_2").f;
phi2 = pj_param(P->ctx, P->params, "rlat_2").f;
+ if (fabs(phi1) > M_HALFPI || fabs(phi2) > M_HALFPI)
+ return pj_default_destructor(P, PJD_ERR_LAT_LARGER_THAN_90);
if (fabs(phi1 - phi2) <= TOL ||
(con = fabs(phi1)) <= TOL ||
fabs(con - M_HALFPI) <= TOL ||
diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie
index 235771d5..49b135d9 100644
--- a/test/gie/builtins.gie
+++ b/test/gie/builtins.gie
@@ -4013,6 +4013,16 @@ operation +proj=omerc +lat_1=0.8 +a=6400000 +b=.4
-------------------------------------------------------------------------------
expect failure errno invalid_eccentricity
+-------------------------------------------------------------------------------
+operation +proj=omerc +lat_1=91
+-------------------------------------------------------------------------------
+expect failure errno lat_larger_than_90
+
+-------------------------------------------------------------------------------
+operation +proj=omerc +lat_2=91
+-------------------------------------------------------------------------------
+expect failure errno lat_larger_than_90
+
===============================================================================
Ortelius Oval