Crash on FreeBSD because of the use of Exiv2::Error
In header file exiv2/error.hpp, Exiv2::Error
is declared as Exiv2::BasicError<char>
, but Exiv2::BasicError
isn't marked as EXIV2API
, suggesting it isn't an exported type and should not be used by other libraries or applications. The use of Exiv2::Error
in gexiv2 causes GNOME Photos to crash on FreeBSD because gexiv2_metadata_register_xmp_namespace
relies on the ability to catch the exception thrown by Exiv2::XmpProperties::ns
. Since typeinfo of Exiv2::BasicError
isn't exported, libcxxrt
doesn't know gexiv2_metadata_register_xmp_namespace
catches the exception and aborts the program.
This problem can be avoided if Exiv2::Error
is replaced by Exiv2::AnyError
. Exiv2::AnyError
is marked as EXIV2API
, so it should be safe to use.
diff --git a/gexiv2/gexiv2-metadata-xmp.cpp b/gexiv2/gexiv2-metadata-xmp.cpp
index eac78b7..8c14e40 100644
--- a/gexiv2/gexiv2-metadata-xmp.cpp
+++ b/gexiv2/gexiv2-metadata-xmp.cpp
@@ -405,7 +405,7 @@ gboolean gexiv2_metadata_register_xmp_namespace (const gchar* name, const gchar*
try {
Exiv2::XmpProperties::ns(prefix);
- } catch (Exiv2::Error& error) {
+ } catch (Exiv2::AnyError& error) {
// No namespace, OK to register
Exiv2::XmpProperties::registerNs(name, prefix);
return TRUE;
Please see https://github.com/Exiv2/exiv2/issues/947 for more details.