From 717f746fbb3cde2245b3ddfa3f77d8d827754af2 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 5 Mar 2024 13:19:32 +0100 Subject: [PATCH] ERS: avoid 'Attempt at recursively opening ERS dataset' when the .ers file references a .ecw (fixes #9352) The issue was no longer reproducible in master/3.9dev due to the https://gdal.org/development/rfc/rfc96_deferred_plugin_loading.html change, but was still somehow latent. This commit fixes the issue in the 3.8 branch --- autotest/gdrivers/data/ers/references_ecw.ecw | Bin 0 -> 21879 bytes autotest/gdrivers/data/ers/references_ecw.ers | 14 ++++++++++++++ autotest/gdrivers/ers.py | 10 ++++++++++ frmts/ers/ersdataset.cpp | 10 +++++----- 4 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 autotest/gdrivers/data/ers/references_ecw.ecw create mode 100644 autotest/gdrivers/data/ers/references_ecw.ers diff --git a/autotest/gdrivers/data/ers/references_ecw.ecw b/autotest/gdrivers/data/ers/references_ecw.ecw new file mode 100644 index 0000000000000000000000000000000000000000..ade6498f16069081e6729e884cd4a9205e15bb77 GIT binary patch literal 21879 zcmZsCbzBwC8}5RL0g8yyp@bM9(%m2;B_LhW-Q5c)Atiz!{Z$Y|x*JqVI;9RJb)?Rr zJMJw0?)~cypV^%{d(Q4W`@GNl&R~j*gL457f^aW^3_&>HPYnEB#X0OC9yD;U5WDm1 zw!J}z#dp}eXs*yoL;O@g$z)GkTwGCHijNc0z#)b}B7z`!4oPu&9t8-g-vM2DhQ(biJN@>O|S?A3xeM%3c-B;z8YqQU|9%e zgJ1~=764tmAag)4a&HhU48i=!ne%^xl_6N|yh9&?EkL^-1gnGkbC?8zv4P|haW=l4KPLnf|)@BtPR1M5F{xLidv8g1d~GWOHh6c!OtLA z===&?5G;lam4sk03>4(S;pJ0U2^8fZ_&Eeioi{%Lbs12Sc?JrPKvsp|2N0|P!QAKl zPm!Yo=^K3ux^+q= z{cG`Ig?M`(Qxa-*JH`g>_!(d z^s~(!KG)p%e&NQxZ;sb#Vo?KDEZ~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_^amvYm$E-H=I_I zka_2xM{{0jJHGze?3V_rX4PCfvF0mDmEWn%8+;*Ws3svgbLh?VZQZ|hL;Di;_ZL4N zQ8xXVeMdv5ic6ACovUq|XkK}-E3_}d$%eDxx36zOPLDyE-CPK4xonLLT%}(5JB@me zTgvZJu*;CXnLHlIpe_ZLbWw)iZX~!$j|w=fvvtbCa2$LyJ?~cxPVh(c6)7nQGuo8uBe7)O5C|gTc+e!?Ijobgo^pH8$^q93_Xq8`b>X|I z8j;r-SH7zv#c8G8P6B6Q8Qo94G?mq%}nejxNfr|tAPJC1d0d)IKZStaT<-mb3VT`?^d{X1 zgY4{!2}9>uZy??v;iQolZV>#4-LnSqJHp)JCQ-vsSEPx-Br>REkXn)BWab#Hb( z)F#Q=lCV(a7aL9omHXZ#@}#2K~B&{4j)E*^~!$9 z7unkYy23J~pb(wtTX=2nnbgqeBYgvbh6TRCAI*I5FXMrdD`Tl66`KcBKiZI+yz^(> zMYY{6wL7PDC3(CHSc;}19F4U*uL&~GSx8-o`U}SI5orc%Jxq>%STRSWv}b{Fzwwv zyMK~UGkblGaR?fX0BW19Wmb!9)U>KeRhz42m5DrZ4eUJTPJY#9&jjKDZH)$EDdz(* zKnk!GiOMHh(h-)cibVm-9Gt)L0UB$~qniqv#yU@k_ZHP$)FD6MpZfpO$i$Z3{!4!! Jo0Rz?{|S%N-9i8W literal 0 HcmV?d00001 diff --git a/autotest/gdrivers/data/ers/references_ecw.ers b/autotest/gdrivers/data/ers/references_ecw.ers new file mode 100644 index 000000000000..7c16a1b4b20d --- /dev/null +++ b/autotest/gdrivers/data/ers/references_ecw.ers @@ -0,0 +1,14 @@ +DatasetHeader Begin + Version = "6.2" + Name = "references_ecw.ers" + DataFile = "references_ecw.ecw" + DataSetType = Translated + DataType = Raster + ByteOrder = LSBFirst + RasterInfo Begin + CellType = Unsigned8BitInteger + NrOfLines = 512 + NrOfCellsPerLine = 519 + NrOfBands = 1 + RasterInfo End +DatasetHeader End diff --git a/autotest/gdrivers/ers.py b/autotest/gdrivers/ers.py index 82046df69d14..701580704ac9 100755 --- a/autotest/gdrivers/ers.py +++ b/autotest/gdrivers/ers.py @@ -319,6 +319,16 @@ def test_ers_recursive_opening(): ds.GetFileList() +############################################################################### +# Test fix for https://github.com/OSGeo/gdal/issues/9352 + + +@pytest.mark.require_driver("ECW") +def test_ers_open_data_file_ecw(): + + assert gdal.Open("data/ers/references_ecw.ers") + + ############################################################################### # Cleanup diff --git a/frmts/ers/ersdataset.cpp b/frmts/ers/ersdataset.cpp index 919d64f7d4b4..d83ed19b4251 100644 --- a/frmts/ers/ersdataset.cpp +++ b/frmts/ers/ersdataset.cpp @@ -881,17 +881,18 @@ int ERSProxyRasterBand::GetOverviewCount() GDALDataset *ERSDataset::Open(GDALOpenInfo *poOpenInfo) { + if (!Identify(poOpenInfo) || poOpenInfo->fpL == nullptr) + return nullptr; + + int &nRecLevel = GetRecLevel(); // cppcheck-suppress knownConditionTrueFalse - if (GetRecLevel()) + if (nRecLevel) { CPLError(CE_Failure, CPLE_AppDefined, "Attempt at recursively opening ERS dataset"); return nullptr; } - if (!Identify(poOpenInfo) || poOpenInfo->fpL == nullptr) - return nullptr; - /* -------------------------------------------------------------------- */ /* Ingest the file as a tree of header nodes. */ /* -------------------------------------------------------------------- */ @@ -1020,7 +1021,6 @@ GDALDataset *ERSDataset::Open(GDALOpenInfo *poOpenInfo) /* -------------------------------------------------------------------- */ if (EQUAL(poHeader->Find("DataSetType", ""), "Translated")) { - int &nRecLevel = GetRecLevel(); nRecLevel++; poDS->poDepFile = GDALDataset::FromHandle( GDALOpen(osDataFilePath, poOpenInfo->eAccess));