diff options
| author | Kurt Schwehr <schwehr@google.com> | 2018-03-25 13:51:58 -0700 |
|---|---|---|
| committer | Kurt Schwehr <schwehr@google.com> | 2018-03-25 13:51:58 -0700 |
| commit | e52ab929670eaa65cc6c0284f24d3c0fa53f6bcc (patch) | |
| tree | 0476b184efdb26f378727f145158b7cfd6d6650f /src | |
| parent | 19aef5185f5b39f6c90956da146d26eba142d2a0 (diff) | |
| download | PROJ-e52ab929670eaa65cc6c0284f24d3c0fa53f6bcc.tar.gz PROJ-e52ab929670eaa65cc6c0284f24d3c0fa53f6bcc.zip | |
Catch over range lam0 in proj_etmerc.c
lam0 of inf caused a nan in the cast to int.
Picked +/-1000 for lam0 as a guess for what constitutes reduculously large values.
proj_etmerc.c:361:16: runtime error: nan is outside the range of representable values of type 'int'
Found with autofuzz: UndefinedBehaviorSanitizer: float-cast-overflow
Diffstat (limited to 'src')
| -rw-r--r-- | src/proj_etmerc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/proj_etmerc.c b/src/proj_etmerc.c index ffb10930..99646d14 100644 --- a/src/proj_etmerc.c +++ b/src/proj_etmerc.c @@ -345,6 +345,10 @@ PJ *PROJECTION(utm) { proj_errno_set(P, PJD_ERR_ELLIPSOID_USE_REQUIRED); return pj_default_destructor(P, ENOMEM); } + if (P->lam0 < -1000.0 || P->lam0 > 1000.0) { + return pj_default_destructor(P, PJD_ERR_INVALID_UTM_ZONE); + } + P->y0 = pj_param (P->ctx, P->params, "bsouth").i ? 10000000. : 0.; P->x0 = 500000.; if (pj_param (P->ctx, P->params, "tzone").i) /* zone input ? */ |
