From 9b07cff26a27d57b3603b079c271644ebc0b121d Mon Sep 17 00:00:00 2001 From: clanmills Date: Sun, 29 Mar 2020 15:57:40 +0100 Subject: [PATCH 1/2] Adding test files --- test/data/issue_94_poc3.pgf | Bin 0 -> 28349 bytes tests/bugfixes/github/test_issue_984.py | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 test/data/issue_94_poc3.pgf create mode 100644 tests/bugfixes/github/test_issue_984.py diff --git a/test/data/issue_94_poc3.pgf b/test/data/issue_94_poc3.pgf new file mode 100644 index 0000000000000000000000000000000000000000..d4747083fbae04c7c113664e8afeed7867501265 GIT binary patch literal 28349 zcmeI*!A^rP7{Kv*l(-l0M0kL;UJ2V`oLiRYvZ#k$abuAvjBFfu1rI)s?`IjXA;Oe{ zi6(z8Yx{luXn%0%Y0SnW^&SeLD%b05I_?s&T_Esc z*Gz(!aBC;M%0Dt#W|Ebv2C`ABuavV{uI#(vC@-OV^|=j8vigQ;?rIFZ?PB9cvA+(@ zw5FTR=vkJIn|blrUwv1-oSwMR@wJqby~NkGpW-;Or3|+@u%?#jUFAhr$z6Kdv+wiW z94}vN`7m!%4C#&OW?i5Z(d)Ob_A|1;q1({f)l4^I&pu}y?pPBIv#8Wh!;$$D?JGy_ z-;ne%{r<&GS{cIyS1W;5$-G@~wGwER%-i+9xD02Ip9RhQTrtq6Kc)2P^JIU}(4EtL Ur)cQGv!Y%8)#GAvJsqZFAGhsYZU6uP literal 0 HcmV?d00001 diff --git a/tests/bugfixes/github/test_issue_984.py b/tests/bugfixes/github/test_issue_984.py new file mode 100644 index 00000000..fb7b8393 --- /dev/null +++ b/tests/bugfixes/github/test_issue_984.py @@ -0,0 +1,20 @@ +import system_tests + + +class XMPMetaDeleteNamespace( + metaclass=system_tests.CaseMeta): + """ + Regression test for the bug described in: + https://github.com/Exiv2/exiv2/issues/984 + """ + url = "https://github.com/Exiv2/exiv2/issues/984" + + filename = system_tests.path( + "$data_path/issue_94_poc3.pgf" + ) + commands = ["$exiv2json $filename"] + stdout = ["""Caught Exiv2 exception 'XMP Toolkit error 9: Fatal namespace map problem' +"""] + stderr = ["""Warning: Removing 54 characters from the beginning of the XMP packet +"""] + retval = [1] From 0eabfc4053a56493dc5ef8269cd5d4f925efeec9 Mon Sep 17 00:00:00 2001 From: clanmills Date: Sun, 29 Mar 2020 15:58:03 +0100 Subject: [PATCH 2/2] Adding CPP changes --- samples/exiv2json.cpp | 4 ++-- xmpsdk/src/XMPMeta.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/exiv2json.cpp b/samples/exiv2json.cpp index 4f43280d..07707219 100644 --- a/samples/exiv2json.cpp +++ b/samples/exiv2json.cpp @@ -347,11 +347,11 @@ int main(int argc, char* const argv[]) Jzon::Writer writer(root, Jzon::StandardFormat); writer.Write(); std::cout << writer.GetResult() << std::endl; - return 0; + return EXIT_SUCCESS; } catch (Exiv2::Error& e) { std::cout << "Caught Exiv2 exception '" << e.what() << "'\n"; - return -1; + return EXIT_FAILURE; } } diff --git a/xmpsdk/src/XMPMeta.cpp b/xmpsdk/src/XMPMeta.cpp index b3af7429..30ff4a5a 100644 --- a/xmpsdk/src/XMPMeta.cpp +++ b/xmpsdk/src/XMPMeta.cpp @@ -1128,7 +1128,7 @@ XMPMeta::DeleteNamespace ( XMP_StringPtr namespaceURI ) if ( uriPos == sNamespaceURIToPrefixMap->end() ) return; XMP_StringMapPos prefixPos = sNamespacePrefixToURIMap->find ( uriPos->second ); - XMP_Assert ( prefixPos != sNamespacePrefixToURIMap->end() ); + if ( prefixPos == sNamespacePrefixToURIMap->end() ) return; sNamespaceURIToPrefixMap->erase ( uriPos ); sNamespacePrefixToURIMap->erase ( prefixPos );