aboutsummaryrefslogtreecommitdiff
path: root/src/projections/stere.cpp
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2019-03-25 08:34:16 +0100
committerGitHub <noreply@github.com>2019-03-25 08:34:16 +0100
commit56784e70f3903cd1a0a7a3d47dfef7f837400d28 (patch)
treebe1b9edddd34449a542d4da15c1a4c021d95a849 /src/projections/stere.cpp
parente1e0cfdf88b17b1e9fc5e9f81e0619a4cf1a511b (diff)
parent2e60df106deba4455089143e5ae0a4ea1858a3e1 (diff)
downloadPROJ-56784e70f3903cd1a0a7a3d47dfef7f837400d28.tar.gz
PROJ-56784e70f3903cd1a0a7a3d47dfef7f837400d28.zip
Merge pull request #1359 from rouault/fix_ossfuzz_13892_and_others
Fix ossfuzz 13892, 13893, 13894, 13895
Diffstat (limited to 'src/projections/stere.cpp')
-rw-r--r--src/projections/stere.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/projections/stere.cpp b/src/projections/stere.cpp
index 9836f341..fd9f9827 100644
--- a/src/projections/stere.cpp
+++ b/src/projections/stere.cpp
@@ -55,11 +55,18 @@ static PJ_XY e_forward (PJ_LP lp, PJ *P) { /* Ellipsoidal, forward */
}
switch (Q->mode) {
- case OBLIQ:
- A = Q->akm1 / (Q->cosX1 * (1. + Q->sinX1 * sinX +
- Q->cosX1 * cosX * coslam));
+ case OBLIQ: {
+ const double denom = Q->cosX1 * (1. + Q->sinX1 * sinX +
+ Q->cosX1 * cosX * coslam);
+ if( denom == 0 ) {
+ proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION);
+ return proj_coord_error().xy;
+ }
+ A = Q->akm1 / denom;
xy.y = A * (Q->cosX1 * sinX - Q->sinX1 * cosX * coslam);
- goto xmul; /* but why not just xy.x = A * cosX; break; ? */
+ xy.x = A * cosX;
+ break;
+ }
case EQUIT:
/* avoid zero division */
@@ -69,7 +76,6 @@ static PJ_XY e_forward (PJ_LP lp, PJ *P) { /* Ellipsoidal, forward */
A = Q->akm1 / (1. + cosX * coslam);
xy.y = A * sinX;
}
-xmul:
xy.x = A * cosX;
break;