| Summary: | Nullptr crash in LegacyWebArchive::createPropertyListRepresentation when copying selected range that contains surrogate characters | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Jack <shihchieh_lee> | ||||
| Component: | HTML Editing | Assignee: | Nobody <webkit-unassigned> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | bfulgham, ews-feeder, ggaren, product-security, rniwa, webkit-bug-importer, wenson_hsieh | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Nightly Build | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Attachments: |
|
||||||
|
Description
Jack
2020-05-08 20:25:00 PDT
<body><span id=span></span>
<script>
span.offsetParent.before(document.createElement("frameset"));
span.prepend("\ud800");
document.execCommand("selectAll", true);
document.execCommand("copy", true);
</script>
1. In this test case we are processing copy command and try to create LegacyWebArchive to describe the selected elements.
2. One element in the selection contains surrogate pairs so function convertUTF16ToUTF8() fails which makes creation of LegacyWebArchive to fail.
3. However, function LegacyWebArchive::createFromSelection does not check null LegacyWebArchive and continue to add the Ref() of it into a vector.
4. Eventually in LegacyWebArchive::createPropertyListRepresentation() it crashes when we try to pop the Ref() of LegacyWebArchive from the vetor and dereference the pointer of Ref().
Node tree when we are creating LegacyWebArchive:
*#document 0x106fc5ba0 (renderer 0x106fc5210)
HTML 0x106fc6800 (renderer 0x106fc56c0)
HEAD 0x106fc6890 (renderer 0x0)
FRAMESET 0x106fc6d30 (renderer 0x106fc6e40)
BODY 0x106fc6920 (renderer 0x106fc57f0)
SPAN 0x106fc69b0 (renderer 0x106fc6bd0)
#text 0x106fc6de0 "???"
#text 0x106fc6a40 "\n"
SCRIPT 0x106fc6aa0 (renderer 0x0)
#text 0x106fc6b70 "\n span.offsetParent.before(document.createElement("frameset"));\n span.prepend("\\ud800");\n document.execCommand("selectAll", true);\n document.execCommand("copy", true);\n"
Created attachment 398914 [details]
Patch
Committed r261434: <https://trac.webkit.org/changeset/261434> All reviewed patches have been landed. Closing bug and clearing flags on attachment 398914 [details]. |