aboutsummaryrefslogtreecommitdiff
path: root/src/pj_transform.c
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2018-01-25 15:51:37 +0100
committerEven Rouault <even.rouault@spatialys.com>2018-01-25 15:51:37 +0100
commitaff1011a16372465ffeca05b0d7fcc8a9c2cf86e (patch)
tree427643fe1f01c18b36de5dd929a2a7505a4cbd7f /src/pj_transform.c
parent29cb4a05153ec8dd13857b6b9329fa2a6c067840 (diff)
downloadPROJ-aff1011a16372465ffeca05b0d7fcc8a9c2cf86e.tar.gz
PROJ-aff1011a16372465ffeca05b0d7fcc8a9c2cf86e.zip
Fix null pointer dereference in pj_datum_tranform() caused by d0dbf48438f9e152314abf294467cb54f9ae0e70 changes. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5649. Credit to OSS Fuzz
Diffstat (limited to 'src/pj_transform.c')
-rw-r--r--src/pj_transform.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pj_transform.c b/src/pj_transform.c
index 6ad227cd..fc0a3241 100644
--- a/src/pj_transform.c
+++ b/src/pj_transform.c
@@ -756,7 +756,8 @@ int pj_datum_transform( PJ *srcdefn, PJ *dstdefn,
/* If the gridlist has either "@null" or "null" as its only */
/* grid we don't change the ellipsoid parameters, since the */
/* datum shift to WGS84 was not performed in practice. */
- if ( strcmp("@null", srcnadgrids) && strcmp("null", srcnadgrids) ) {
+ if ( srcnadgrids != NULL &&
+ strcmp("@null", srcnadgrids) && strcmp("null", srcnadgrids) ) {
src_a = SRS_WGS84_SEMIMAJOR;
src_es = SRS_WGS84_ESQUARED;
}
@@ -768,7 +769,8 @@ int pj_datum_transform( PJ *srcdefn, PJ *dstdefn,
/* If the gridlist has either "@null" or "null" as its only */
/* grid we don't change the ellipsoid parameters, since the */
/* datum shift to WGS84 will not be performed. */
- if ( strcmp("@null", dstnadgrids) && strcmp("null", dstnadgrids) ) {
+ if ( dstnadgrids != NULL &&
+ strcmp("@null", dstnadgrids) && strcmp("null", dstnadgrids) ) {
dst_a = SRS_WGS84_SEMIMAJOR;
dst_es = SRS_WGS84_ESQUARED;
}