The following SVG crashes if it's saved as .html file: <svg xmlns="http://www.w3.org/2000/svg"> <g> <set attributename="class"></set> </g> </svg> The backtrace: (it seems that m_ptr is a null pointer) Program received signal SIGSEGV, Segmentation fault. 0x00007ffff3d58938 in WTF::RefPtr<WebCore::SpaceSplitStringData>::operator WebCore::SpaceSplitStringData* WTF::RefPtr<WebCore::SpaceSplitStringData>::* ( this=0x18) at /home/reni/Data/REPOS/webkit_sec/Source/WTF/wtf/RefPtr.h:76 76 operator UnspecifiedBoolType() const { return m_ptr ? &RefPtr::m_ptr : 0; } (gdb) bt #0 0x00007ffff3d58938 in WTF::RefPtr<WebCore::SpaceSplitStringData>::operator WebCore::SpaceSplitStringData* WTF::RefPtr<WebCore::SpaceSplitStringData>::* ( this=0x18) at /home/reni/Data/REPOS/webkit_sec/Source/WTF/wtf/RefPtr.h:76 #1 0x00007ffff3d579fe in WebCore::SpaceSplitString::size (this=0x18) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/dom/SpaceSplitString.h:83 #2 0x00007ffff42f3349 in WebCore::checkSelectorForClassChange<WebCore::StyleResolver> (changedClasses=..., checker=...) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/dom/Element.cpp:1102 #3 0x00007ffff42e95e1 in WebCore::Element::classAttributeChanged (this=0x8a7d80, newClassString=...) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/dom/Element.cpp:1154 #4 0x00007ffff4db00a8 in WebCore::SVGStyledElement::svgAttributeChanged (this=0x8a7d80, attrName=...) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/svg/SVGStyledElement.cpp:333 #5 0x00007ffff4d67588 in WebCore::SVGGraphicsElement::svgAttributeChanged (this=0x8a7d80, attrName=...) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/svg/SVGGraphicsElement.cpp:128 #6 0x00007ffff4d61031 in WebCore::SVGGElement::svgAttributeChanged (this=0x8a7d80, attrName=...) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/svg/SVGGElement.cpp:82 #7 0x00007ffff4d0a1bc in WebCore::notifyTargetAboutAnimValChange (targetElement=0x8a7d80, attributeName=...) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/svg/SVGAnimateElement.cpp:299 #8 0x00007ffff4d0a290 in WebCore::notifyTargetAndInstancesAboutAnimValChange (targetElement=0x8a7d80, attributeName=...) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/svg/SVGAnimateElement.cpp:309 #9 0x00007ffff4d0a61c in WebCore::SVGAnimateElement::applyResultsToTarget (this=0x8b50c0) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/svg/SVGAnimateElement.cpp:368 #10 0x00007ffff4cb39aa in WebCore::SMILTimeContainer::updateAnimations (this=0x88bb60, elapsed=..., seekToTime=false) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/svg/animation/SMILTimeContainer.cpp:316 #11 0x00007ffff4cb2cf8 in WebCore::SMILTimeContainer::begin (this=0x88bb60) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/svg/animation/SMILTimeContainer.cpp:139 #12 0x00007ffff4cd7abb in WebCore::SVGDocumentExtensions::startAnimations (this=0x88ddc0) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/svg/SVGDocumentExtensions.cpp:102 #13 0x00007ffff42951c3 in WebCore::Document::implicitClose (this=0x873e10) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/dom/Document.cpp:2478 #14 0x00007ffff4689ec3 in WebCore::FrameLoader::checkCallImplicitClose (this=0x7ad258) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/loader/FrameLoader.cpp:843 #15 0x00007ffff4689c2e in WebCore::FrameLoader::checkCompleted (this=0x7ad258) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/loader/FrameLoader.cpp:786 #16 0x00007ffff468996c in WebCore::FrameLoader::finishedParsing (this=0x7ad258) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/loader/FrameLoader.cpp:719 #17 0x00007ffff429c03b in WebCore::Document::finishedParsing (this=0x873e10) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/dom/Document.cpp:4417 #18 0x00007ffff44e8dd3 in WebCore::HTMLConstructionSite::finishedParsing (this=0x7efaa8) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/html/parser/HTMLConstructionSite.cpp:348 #19 0x00007ffff451a4bf in WebCore::HTMLTreeBuilder::finished (this=0x7efa90) ---Type <return> to continue, or q <return> to quit--- at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/html/parser/HTMLTreeBuilder.cpp:2926 #20 0x00007ffff44f0386 in WebCore::HTMLDocumentParser::end (this=0x7676e0) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/html/parser/HTMLDocumentParser.cpp:756 #21 0x00007ffff44f0473 in WebCore::HTMLDocumentParser::attemptToRunDeferredScriptsAndEnd (this=0x7676e0) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/html/parser/HTMLDocumentParser.cpp:767 #22 0x00007ffff44ef0a6 in WebCore::HTMLDocumentParser::prepareToStopParsing (this=0x7676e0) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/html/parser/HTMLDocumentParser.cpp:211 #23 0x00007ffff44f04b6 in WebCore::HTMLDocumentParser::attemptToEnd (this=0x7676e0) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/html/parser/HTMLDocumentParser.cpp:779 #24 0x00007ffff44f056d in WebCore::HTMLDocumentParser::finish (this=0x7676e0) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/html/parser/HTMLDocumentParser.cpp:828 #25 0x00007ffff46819b5 in WebCore::DocumentWriter::end (this=0x694320) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/loader/DocumentWriter.cpp:248 #26 0x00007ffff467459e in WebCore::DocumentLoader::finishedLoading (this=0x694280, finishTime=0) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/loader/DocumentLoader.cpp:402 #27 0x00007ffff467430c in WebCore::DocumentLoader::notifyFinished (this=0x694280, resource=0x7724a0) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/loader/DocumentLoader.cpp:344 #28 0x00007ffff465b9d8 in WebCore::CachedResource::checkNotify (this=0x7724a0) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/loader/cache/CachedResource.cpp:369 #29 0x00007ffff465baae in WebCore::CachedResource::finishLoading (this=0x7724a0) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/loader/cache/CachedResource.cpp:385 #30 0x00007ffff46581be in WebCore::CachedRawResource::finishLoading (this=0x7724a0, data=0x782aa0) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/loader/cache/CachedRawResource.cpp:94 #31 0x00007ffff46bda4a in WebCore::SubresourceLoader::didFinishLoading (this=0x753390, finishTime=0) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/loader/SubresourceLoader.cpp:282 #32 0x00007ffff46b43d7 in WebCore::ResourceLoader::didFinishLoading (this=0x753390, finishTime=0) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/loader/ResourceLoader.cpp:488 #33 0x00007ffff4b4179c in WebCore::QNetworkReplyHandler::finish (this=0x753fb0) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp:516 #34 0x00007ffff4b40462 in WebCore::QNetworkReplyHandlerCallQueue::flush (this=0x753fe8) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp:250 #35 0x00007ffff4b4018a in WebCore::QNetworkReplyHandlerCallQueue::push (this=0x753fe8, method=(void (WebCore::QNetworkReplyHandler::*)(WebCore::QNetworkReplyHandler * const)) 0x7ffff4b415de <WebCore::QNetworkReplyHandler::finish()>) at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp:216 #36 0x00007ffff4b410e8 in WebCore::QNetworkReplyWrapper::didReceiveFinished (this=0x754360) ---Type <return> to continue, or q <return> to quit--- at /home/reni/Data/REPOS/webkit_sec/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp:409 #37 0x00007ffff4b43aaa in WebCore::QNetworkReplyWrapper::qt_static_metacall (_o=0x754360, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fffffffcf80) at .moc/release-shared/moc_QNetworkReplyHandler.cpp:176 #38 0x00007ffff231e5cb in QMetaObject::activate(QObject*, int, int, void**) () from /usr/local/Trolltech/Qt5/Qt-5.0.0-r40/lib/libQt5Core.so.5 #39 0x00007ffff231f84e in QObject::event(QEvent*) () from /usr/local/Trolltech/Qt5/Qt-5.0.0-r40/lib/libQt5Core.so.5 #40 0x00007ffff3165dbc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/local/Trolltech/Qt5/Qt-5.0.0-r40/lib/libQt5Widgets.so.5 #41 0x00007ffff3169075 in QApplication::notify(QObject*, QEvent*) () from /usr/local/Trolltech/Qt5/Qt-5.0.0-r40/lib/libQt5Widgets.so.5 #42 0x00007ffff22f9dbe in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/local/Trolltech/Qt5/Qt-5.0.0-r40/lib/libQt5Core.so.5 #43 0x00007ffff22fba76 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/local/Trolltech/Qt5/Qt-5.0.0-r40/lib/libQt5Core.so.5 #44 0x00007ffff2341333 in ?? () from /usr/local/Trolltech/Qt5/Qt-5.0.0-r40/lib/libQt5Core.so.5 #45 0x00007fffee4840a6 in g_main_dispatch (context=0x6632f0) at /build/buildd/glib2.0-2.37.3/./glib/gmain.c:3058 #46 g_main_context_dispatch (context=context@entry=0x6632f0) at /build/buildd/glib2.0-2.37.3/./glib/gmain.c:3634 #47 0x00007fffee4843f8 in g_main_context_iterate (context=context@entry=0x6632f0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /build/buildd/glib2.0-2.37.3/./glib/gmain.c:3705 #48 0x00007fffee48449c in g_main_context_iteration (context=0x6632f0, may_block=1) at /build/buildd/glib2.0-2.37.3/./glib/gmain.c:3766 #49 0x00007ffff23414bc in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/local/Trolltech/Qt5/Qt-5.0.0-r40/lib/libQt5Core.so.5 #50 0x00007ffff22f8d3b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/local/Trolltech/Qt5/Qt-5.0.0-r40/lib/libQt5Core.so.5 #51 0x00007ffff22fc120 in QCoreApplication::exec() () from /usr/local/Trolltech/Qt5/Qt-5.0.0-r40/lib/libQt5Core.so.5 #52 0x0000000000421ba0 in launcherMain (app=...) at /home/reni/Data/REPOS/webkit_sec/Tools/QtTestBrowser/qttestbrowser.cpp:49 #53 0x0000000000423680 in main (argc=2, argv=0x7fffffffdc58) at /home/reni/Data/REPOS/webkit_sec/Tools/QtTestBrowser/qttestbrowser.cpp:318
Created attachment 206971 [details] Test case
Created attachment 208308 [details] Patch
Comment on attachment 208308 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=208308&action=review > Source/WebCore/svg/SVGStyledElement.cpp:334 > + if (!elementData()) > + ensureUniqueElementData(); This fix does not look right. The bug seems to be in Element::classAttributeChanged and the fix should be there as well.
Created attachment 208338 [details] Patch
(In reply to comment #3) > (From update of attachment 208308 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=208308&action=review > > > Source/WebCore/svg/SVGStyledElement.cpp:334 > > + if (!elementData()) > > + ensureUniqueElementData(); > > This fix does not look right. The bug seems to be in Element::classAttributeChanged and the fix should be there as well. Right, I just thought that this problem can only happen in SVG, since only in SVG the situation can be that no attributes have been processed and classAttributeChanged is called (through animation). I don't think elementData() can be null when entering classAttributeChanged outside of SVG. I was hesitating between the two approaches a lot... Anyway the new patch tries to fix things in Element::classAttributeChanged.
Committed r153835: <http://trac.webkit.org/changeset/153835>