|Summary:||REGRESSION(58040): TextIterator may use freed memory|
|Product:||WebKit||Reporter:||Shinichiro Hamaji <hamaji>|
|Component:||HTML Editing||Assignee:||Nobody <webkit-unassigned>|
|Version:||528+ (Nightly build)|
Description Shinichiro Hamaji 2010-04-21 23:25:57 PDT
http://trac.webkit.org/changeset/58040 modified TextIterator::emitText and it uses RenderText::textWithoutTranscoding which may return String with refcnt==1 . TextIterator::emitText doesn't increment the refcnt of the returned String so the String created by textWithoutTranscoding() will be freed when emitString() finishes. This means we will touch the freed buffer. The test I added in r58040 happened to work for most platforms except chromium-win-debug (maybe because the iterator uses the freed buffer soon after the buffer is freed). My apologies for this bug.
Comment 2 Shinichiro Hamaji 2010-04-21 23:29:33 PDT
*** Bug 37907 has been marked as a duplicate of this bug. ***
Comment 3 Darin Adler 2010-04-22 12:56:05 PDT
Comment on attachment 54028 [details] Patch v1 WebCore/editing/TextIterator.h:130 + // Prevent m_textCharacters from being freed. + String m_text; I think this comment is not as clear as it could be, but I don't have any specific suggestions for improving it.