diff options
| author | Thomas Knudsen <thokn@sdfe.dk> | 2017-11-22 09:39:54 +0100 |
|---|---|---|
| committer | Thomas Knudsen <thokn@sdfe.dk> | 2017-11-22 09:39:54 +0100 |
| commit | 55335038504a298a51a0da8cca380cb247695378 (patch) | |
| tree | 4d2e9c1339f7d891479448615bdfd8a9a7e62342 /src | |
| parent | 5f1522ad7652e562f98328b05d905c407bab99e9 (diff) | |
| download | PROJ-55335038504a298a51a0da8cca380cb247695378.tar.gz PROJ-55335038504a298a51a0da8cca380cb247695378.zip | |
Avoid div-by-zero in rf setup
Diffstat (limited to 'src')
| -rw-r--r-- | src/pj_ell_set.c | 4 | ||||
| -rw-r--r-- | src/projects.h | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/pj_ell_set.c b/src/pj_ell_set.c index 8ba928b7..18beb875 100644 --- a/src/pj_ell_set.c +++ b/src/pj_ell_set.c @@ -237,6 +237,8 @@ static int pj_shape (PJ *P) { P->rf = pj_atof (pj_param_value (par)); if (HUGE_VAL==P->rf) return proj_errno_set (P, PJD_ERR_INVALID_ARG); + if (0==P->rf) + return proj_errno_set (P, PJD_ERR_REV_FLATTENING_IS_ZERO); P->f = 1 / P->rf; P->es = 2*P->f - P->f*P->f; break; @@ -279,7 +281,7 @@ static int pj_shape (PJ *P) { if (HUGE_VAL==P->b) return proj_errno_set (P, PJD_ERR_INVALID_ARG); if (0==P->b) - return proj_errno_set (P, PJD_ERR_INVALID_ARG); + return proj_errno_set (P, PJD_ERR_ECCENTRICITY_IS_ONE); P->f = (P->a - P->b) / P->a; P->es = 2*P->f - P->f*P->f; break; diff --git a/src/projects.h b/src/projects.h index f8f1fa38..91c0e6a3 100644 --- a/src/projects.h +++ b/src/projects.h @@ -479,14 +479,14 @@ enum deprecated_constants_for_now_dropped_analytical_factors { /* library errors */ #define PJD_ERR_NO_ARGS -1 #define PJD_ERR_NO_OPTION_IN_INIT_FILE -2 -#define PJD_ERR_NO_COLOR_IN_INIT_STRING -3 +#define PJD_ERR_NO_COLON_IN_INIT_STRING -3 #define PJD_ERR_PROJ_NOT_NAMED -4 #define PJD_ERR_UNKNOWN_PROJECTION_ID -5 #define PJD_ERR_ECCENTRICITY_IS_ONE -6 #define PJD_ERR_UNKNOW_UNIT_ID -7 #define PJD_ERR_INVALID_BOOLEAN_PARAM -8 #define PJD_ERR_UNKNOWN_ELLP_PARAM -9 -#define PJD_ERR_REC_FLATTENING_IS_ZERO -10 +#define PJD_ERR_REV_FLATTENING_IS_ZERO -10 #define PJD_ERR_REF_RAD_LARGER_THAN_90 -11 #define PJD_ERR_ES_LESS_THAN_ZERO -12 #define PJD_ERR_MAJOR_AXIS_NOT_GIVEN -13 |
