diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2017-06-13 13:25:44 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2017-06-13 16:13:18 +0200 |
| commit | e1ad1046873056ab3bfc3262bd343e8c874f395c (patch) | |
| tree | 61015aaf17f12eee4bb4eca77aabb4a91501f718 /src/PJ_vgridshift.c | |
| parent | c606094b8fa18a7c6da83b54b5e59f0eb470324c (diff) | |
| download | PROJ-e1ad1046873056ab3bfc3262bd343e8c874f395c.tar.gz PROJ-e1ad1046873056ab3bfc3262bd343e8c874f395c.zip | |
PJ_vgridshift.c: fix memleak in initialization if grid loading fail
When gridloading fail for one grid, but return a gridlist, we leak the grid list array.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2230. Credit to OSS Fuzz
Diffstat (limited to 'src/PJ_vgridshift.c')
| -rw-r--r-- | src/PJ_vgridshift.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/PJ_vgridshift.c b/src/PJ_vgridshift.c index c91db968..72d97517 100644 --- a/src/PJ_vgridshift.c +++ b/src/PJ_vgridshift.c @@ -29,8 +29,8 @@ static XYZ forward_3d(LPZ lpz, PJ *P) { /* Only try the gridshift if at least one grid is loaded, * otherwise just pass the coordinate through unchanged. */ pj_apply_vgridshift( P, "sgrids", - &(P->vgridlist_geoid), - &(P->vgridlist_geoid_count), + &(P->gridlist), + &(P->gridlist_count), 1, 1, 0, &point.xyz.x, &point.xyz.y, &point.xyz.z ); } @@ -47,8 +47,8 @@ static LPZ reverse_3d(XYZ xyz, PJ *P) { /* Only try the gridshift if at least one grid is loaded, * otherwise just pass the coordinate through unchanged. */ pj_apply_vgridshift( P, "sgrids", - &(P->vgridlist_geoid), - &(P->vgridlist_geoid_count), + &(P->gridlist), + &(P->gridlist_count), 0, 1, 0, &point.xyz.x, &point.xyz.y, &point.xyz.z ); } @@ -84,6 +84,8 @@ PJ *PROJECTION(vgridshift) { /* Was gridlist compiled properly? */ if ( pj_ctx_get_errno(P->ctx) ) { pj_log_error(P, "vgridshift: could not find required grid(s)."); + pj_dalloc(P->gridlist); + P->gridlist = NULL; return freeup_msg(P, -38); } |
