From 719fecd1ef47bef5e4ee1f9d83e20bd996afde1e Mon Sep 17 00:00:00 2001 From: jld3103 Date: Wed, 13 Dec 2023 15:04:16 +0100 Subject: [PATCH 1/2] fix: Fail on XML parse error Signed-off-by: jld3103 --- generate-spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/generate-spec b/generate-spec index c5ff669..0342d9f 100755 --- a/generate-spec +++ b/generate-spec @@ -72,6 +72,9 @@ $infoXMLPath = $dir . "/appinfo/info.xml"; if (file_exists($infoXMLPath)) { $xml = simplexml_load_file($infoXMLPath); + if ($xml === false) { + Logger::panic("appinfo", "info.xml file at " . $infoXMLPath . " is not parsable"); + } $appIsCore = false; $appID = (string)$xml->id; From 425cd699b9308ff23bdeb4c0f246b666628322ec Mon Sep 17 00:00:00 2001 From: jld3103 Date: Thu, 14 Dec 2023 07:50:38 +0100 Subject: [PATCH 2/2] fix: Switch to more secure xml parsing Signed-off-by: jld3103 --- generate-spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate-spec b/generate-spec index 0342d9f..fa516d9 100755 --- a/generate-spec +++ b/generate-spec @@ -71,7 +71,7 @@ $phpDocParser = new PhpDocParser($typeParser, $constExprParser); $infoXMLPath = $dir . "/appinfo/info.xml"; if (file_exists($infoXMLPath)) { - $xml = simplexml_load_file($infoXMLPath); + $xml = simplexml_load_string(file_get_contents($infoXMLPath)); if ($xml === false) { Logger::panic("appinfo", "info.xml file at " . $infoXMLPath . " is not parsable"); }