Bug 1747264 - Avoid OOMing if the URL of an XML document is huge. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D134506
This commit is contained in:
Henri Sivonen 2021-12-27 07:31:34 +00:00
parent 6303dd77dd
commit 2f2b2fb6fb

View File

@ -688,7 +688,10 @@ nsParser::Parse(nsIURI* aURL, void* aKey) {
if (rv != NS_OK) {
return rv;
}
NS_ConvertUTF8toUTF16 theName(spec);
nsString theName; // Not nsAutoString due to length and usage
if (!CopyUTF8toUTF16(spec, theName, mozilla::fallible)) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsScanner* theScanner = new nsScanner(theName, false);
CParserContext* pc =