Skip to content

Commit

Permalink
PALSARJaxa: avoid out-of-range access (likely master only / related t…
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Jan 18, 2025
1 parent 76b0d5c commit ba185c4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions frmts/jaxapalsar/jaxapalsardataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,10 +513,13 @@ int PALSARJaxaDataset::Identify(GDALOpenInfo *poOpenInfo)
return 0;

/* First, check that this is a PALSAR image indeed */
if (!STARTS_WITH_CI((char *)(poOpenInfo->pabyHeader + 60), "AL") ||
!STARTS_WITH_CI(
CPLGetBasenameSafe(poOpenInfo->pszFilename).substr(4).c_str(),
"ALPSR"))
if (!STARTS_WITH_CI((char *)(poOpenInfo->pabyHeader + 60), "AL"))
{
return 0;
}
const std::string osBasename = CPLGetBasenameSafe(poOpenInfo->pszFilename);
if (osBasename.size() < 9 ||
!STARTS_WITH_CI(osBasename.c_str() + 4, "ALPSR"))
{
return 0;
}
Expand Down

0 comments on commit ba185c4

Please sign in to comment.