[PATCH] Escape the value of the symbols name attribute

Pavel Zhukov pavel@zhukoff.net
Tue Jan 11 13:21:57 GMT 2022


Symbols name may include < and > characters (go-runtime is an example)
which causes xml parsers to fail.

Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
---
 src/abg-writer.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/abg-writer.cc b/src/abg-writer.cc
index 76ce809b..e2239e01 100644
--- a/src/abg-writer.cc
+++ b/src/abg-writer.cc
@@ -3111,7 +3111,7 @@ write_elf_symbol(const elf_symbol_sptr&	sym,
 
   annotate(sym, ctxt, indent);
   do_indent(o, indent);
-  o << "<elf-symbol name='" << sym->get_name() << "'";
+  o << "<elf-symbol name='" << xml::escape_xml_string(sym->get_name()) << "'";
   if (sym->is_variable() && sym->get_size())
   o << " size='" << sym->get_size() << "'";
 
-- 
2.34.1



More information about the Libabigail mailing list