From aff1011a16372465ffeca05b0d7fcc8a9c2cf86e Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 25 Jan 2018 15:51:37 +0100 Subject: 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 --- src/pj_transform.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3