Skip to content

Commit ea75dfb

Browse files
committed
Shape: fix potential nullptr deref on corrupted CRS in GetSpatialRef() (fix regression introduced by a31c4d0, https://issues.oss-fuzz.com/issues/458229990)
1 parent 45c0cec commit ea75dfb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ogr/ogrsf_frmts/shape/ogrshapelayer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2502,11 +2502,12 @@ const OGRSpatialReference *OGRShapeGeomFieldDefn::GetSpatialRef() const
25022502
if (poSRSNonConst)
25032503
{
25042504
double adfTOWGS84[7];
2505+
const char *pszSRSName = poSRSNonConst->GetName();
25052506
if (CPLTestBool(
25062507
CPLGetConfigOption("USE_OSR_FIND_MATCHES", "YES")) &&
25072508
// Below works around bug fixed in PROJ per
25082509
// https://github.com/OSGeo/PROJ/pull/4599
2509-
!(strstr(poSRSNonConst->GetName(), "NTF (Paris)") != nullptr &&
2510+
!(pszSRSName && strstr(pszSRSName, "NTF (Paris)") != nullptr &&
25102511
poSRSNonConst->GetTOWGS84(adfTOWGS84) == OGRERR_NONE))
25112512
{
25122513
auto poSRSMatch = poSRSNonConst->FindBestMatch();

0 commit comments

Comments
 (0)