From 322eb029ac7fb2ca5319b4c802a3ab6005d08042 Mon Sep 17 00:00:00 2001 From: me-cafebabe Date: Thu, 21 Jul 2022 14:25:53 +0800 Subject: [PATCH] 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) --- gui/rapidxml.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gui/rapidxml.hpp b/gui/rapidxml.hpp index 33a88601..f47807d3 100644 --- a/gui/rapidxml.hpp +++ b/gui/rapidxml.hpp @@ -1390,7 +1390,15 @@ namespace rapidxml // Parse BOM, if any parse_bom(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) {