aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@mines-paris.org>2019-04-22 20:31:50 +0200
committerGitHub <noreply@github.com>2019-04-22 20:31:50 +0200
commit28cdae60149de8b38f7e10072326bb714b79ef0a (patch)
treee5852e807696d04ecf67e20ef39984c119197415
parent1ebec58e22cce57310f40fa5a455b0b89c7f19b6 (diff)
parent1b0c6fbc8b90522983b18772303ff517dec21cd5 (diff)
downloadPROJ-28cdae60149de8b38f7e10072326bb714b79ef0a.tar.gz
PROJ-28cdae60149de8b38f7e10072326bb714b79ef0a.zip
Merge pull request #1440 from rouault/ossfuzz_14410
airy: avoid division by zero
-rw-r--r--src/projections/airy.cpp4
-rw-r--r--test/gie/builtins.gie7
2 files changed, 10 insertions, 1 deletions
diff --git a/src/projections/airy.cpp b/src/projections/airy.cpp
index f7068061..ba6a40ff 100644
--- a/src/projections/airy.cpp
+++ b/src/projections/airy.cpp
@@ -79,6 +79,10 @@ static PJ_XY s_forward (PJ_LP lp, PJ *P) { /* Spheroidal, forward */
}
if (fabs(s = 1. - cosz) > EPS) {
t = 0.5 * (1. + cosz);
+ if(t == 0) {
+ proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION);
+ return xy;
+ }
Krho = -log(t)/s - Q->Cb / t;
} else
Krho = 0.5 - Q->Cb;
diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie
index 49b135d9..3953a1b6 100644
--- a/test/gie/builtins.gie
+++ b/test/gie/builtins.gie
@@ -324,7 +324,7 @@ Airy
===============================================================================
-------------------------------------------------------------------------------
-operation +proj=airy +a=6400000 +lat_1=0 +lat_2=2
+operation +proj=airy +a=6400000
-------------------------------------------------------------------------------
tolerance 0.1 mm
accept 2 1
@@ -404,6 +404,11 @@ expect 0 0
accept 25 25
expect 0.3821 0.4216
+-------------------------------------------------------------------------------
+operation +proj=airy +R=1 +no_cut
+-------------------------------------------------------------------------------
+accept -180 0
+expect failure errno tolerance_condition
===============================================================================
Aitoff