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/test/data/issue_94_poc3.pgf b/test/data/issue_94_poc3.pgf new file mode 100644 index 00000000..d4747083 Binary files /dev/null and b/test/data/issue_94_poc3.pgf differ 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] 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 );