gui: rapidxml: Bail out if detecting ABX header
The parser is supposed to parse plain XMLs, ABX format is not yet supported.
Continuing to parse ABX XMLs would be spamming /tmp/recovery.log until triggering OOM.
Change-Id: I5c01045d6efef0b2ac497b40d78410c2b75d30d0
(cherry picked from commit 0a352091b39cb62f919af0fbed1097194d3188bf)
diff --git a/gui/rapidxml.hpp b/gui/rapidxml.hpp
index 33a8860..f47807d 100644
--- a/gui/rapidxml.hpp
+++ b/gui/rapidxml.hpp
@@ -1390,7 +1390,15 @@
// Parse BOM, if any
parse_bom<Flags>(text);
-
+
+ // Abort if it's ABX format
+ if (text[0] == Ch('A') &&
+ text[1] == Ch('B') &&
+ text[2] == Ch('X')) {
+ RAPIDXML_PARSE_ERROR("ABX Format Unsupported by RapidXML", text);
+ return;
+ }
+
// Parse children
while (1)
{