Skip to content

Commit

Permalink
JP2Lura: fix Identify() method
Browse files Browse the repository at this point in the history
I discovered accidentally the method was mis-identifying a EXR dataset as recognized
by the JP2Lura driver while investigating #11095.
This dates back to 2e650d8 where for some reason (I
suspect wrong copy&paste) the Identify() logic was completely changed
  • Loading branch information
rouault committed Oct 23, 2024
1 parent e24c37a commit 408b761
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions frmts/jp2lura/jp2luradrivercore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,11 @@
int JP2LuraDriverIdentify(GDALOpenInfo *poOpenInfo)

{
if (STARTS_WITH_CI(poOpenInfo->pszFilename, "JP2Lura:"))
return true;

// Check magic number
return poOpenInfo->fpL != nullptr && poOpenInfo->nHeaderBytes >= 4 &&
poOpenInfo->pabyHeader[0] == 0x76 &&
poOpenInfo->pabyHeader[1] == 0x2f &&
poOpenInfo->pabyHeader[2] == 0x31 &&
poOpenInfo->pabyHeader[3] == 0x01;
return poOpenInfo->nHeaderBytes >= 16 &&
(memcmp(poOpenInfo->pabyHeader, jpc_header, sizeof(jpc_header)) ==
0 ||
memcmp(poOpenInfo->pabyHeader + 4, jp2_box_jp,
sizeof(jp2_box_jp)) == 0);
}

/************************************************************************/
Expand Down

0 comments on commit 408b761

Please sign in to comment.