mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 01:00:05 +00:00
LibWeb: Reject improperly encoded XML documents as not well-formed
This commit is contained in:
parent
278e8afb42
commit
9677d8eeac
Notes:
sideshowbarker
2024-07-16 23:44:30 +09:00
Author: https://github.com/IdanHo
Commit: 9677d8eeac
Pull-request: https://github.com/SerenityOS/serenity/pull/21968
Issue: https://github.com/SerenityOS/serenity/issues/21779
1 changed files with 3 additions and 0 deletions
|
@ -159,6 +159,9 @@ bool build_xml_document(DOM::Document& document, ByteBuffer const& data, Optiona
|
||||||
decoder = TextCodec::decoder_for(encoding);
|
decoder = TextCodec::decoder_for(encoding);
|
||||||
}
|
}
|
||||||
VERIFY(decoder.has_value());
|
VERIFY(decoder.has_value());
|
||||||
|
// Well-formed XML documents contain only properly encoded characters
|
||||||
|
if (!decoder->validate(data))
|
||||||
|
return false;
|
||||||
auto source = decoder->to_utf8(data).release_value_but_fixme_should_propagate_errors();
|
auto source = decoder->to_utf8(data).release_value_but_fixme_should_propagate_errors();
|
||||||
XML::Parser parser(source, { .resolve_external_resource = resolve_xml_resource });
|
XML::Parser parser(source, { .resolve_external_resource = resolve_xml_resource });
|
||||||
XMLDocumentBuilder builder { document };
|
XMLDocumentBuilder builder { document };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue