diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2018-04-13 22:42:54 +0200 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2018-04-13 23:17:49 +0200 |
| commit | 299135153e33869157ecd432dd0194743e959170 (patch) | |
| tree | aaf75f77a87f6ad4c5bdcefcd4a8ce4e2733b23c /src/pj_apply_gridshift.c | |
| parent | a023410e98ae879567963fb04fbd6e43ec67a6ae (diff) | |
| download | PROJ-299135153e33869157ecd432dd0194743e959170.tar.gz PROJ-299135153e33869157ecd432dd0194743e959170.zip | |
Fix segfault in deformation
When transforming coordinates outside the grid model the deformation
operation failed spectatularly. This is now fixed by checking that the
coordinate is inside the grid. If it isn't an error is returned and a
debugging log message is issued.
Closes #934
Diffstat (limited to 'src/pj_apply_gridshift.c')
| -rw-r--r-- | src/pj_apply_gridshift.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pj_apply_gridshift.c b/src/pj_apply_gridshift.c index c503ec0b..1ef39b20 100644 --- a/src/pj_apply_gridshift.c +++ b/src/pj_apply_gridshift.c @@ -306,13 +306,18 @@ int proj_hgrid_init(PJ* P, const char *grids) { /********************************************/ LP proj_hgrid_value(PJ *P, LP lp) { struct CTABLE *ct; - LP out; + LP out = proj_coord_error().lp; ct = find_ctable(P->ctx, lp, P->gridlist_count, P->gridlist); + if (ct == 0) { + pj_ctx_set_errno( P->ctx, PJD_ERR_GRID_AREA); + return out; + } /* normalize input to ll origin */ lp.lam -= ct->ll.lam; lp.phi -= ct->ll.phi; + lp.lam = adjlon(lp.lam - M_PI) + M_PI; out = nad_intr(lp, ct); |
