RESOLVED DUPLICATE of bug 6105362070
XML memory parser handles NULL bytes wrong
https://bugs.webkit.org/show_bug.cgi?id=62070
Summary XML memory parser handles NULL bytes wrong
Vicki Pfau
Reported 2011-06-03 16:49:09 PDT
XML memory parser handles NULL bytes wrong
Attachments
Patch (7.48 KB, patch)
2011-06-03 16:53 PDT, Vicki Pfau
ap: review-
Vicki Pfau
Comment 1 2011-06-03 16:53:19 PDT
Alexey Proskuryakov
Comment 2 2011-06-03 17:30:27 PDT
Comment on attachment 95989 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=95989&action=review Please see bug 61053, which is related or even a duplicate. It it covers what is being fixed here, please dupe to the older bug. If this fixes test cases from that bug, please consider adding them to the patch. > LayoutTests/ChangeLog:8 > + Added test cases for handling NULL bytes as inserted through the outerHTML property. Do these actually pass in Firefox? It's always good to have tests that can be compared to other implementations. > Source/WebCore/dom/XMLDocumentParserLibxml2.cpp:504 > +PassRefPtr<XMLParserContext> XMLParserContext::createMemoryParser(xmlSAXHandlerPtr handlers, void* userData, const char* chunk, int len) Please don't abbreviate. Maybe "chunkLength" or "chunkSize" would be good names? > Source/WebCore/dom/XMLDocumentParserLibxml2.cpp:1457 > + ASSERT(m_sawError || !chunkAsUtf8.data()[bytesProcessed]); This will be an out of bounds read if bytesProcessed is -1. Also, I don't quite understand the logic. If a null byte causes a failure, why doesn't m_sawError get set? I don't remember this code well enough to know why a JS exception will be raised without setting m_sawError. Could you please explain where the exception flies from?
Vicki Pfau
Comment 3 2011-06-07 10:06:55 PDT
*** This bug has been marked as a duplicate of bug 61053 ***
Lucas Forschler
Comment 4 2019-02-06 09:03:12 PST
Mass moving XML DOM bugs to the "DOM" Component.
Note You need to log in before you can comment on or make changes to this bug.