RESOLVED DUPLICATE of bug 73874 73896
REGRESSION(r101713): KURL(ParsedURLStringTag, const String& url) breaks with null strings
https://bugs.webkit.org/show_bug.cgi?id=73896
Summary REGRESSION(r101713): KURL(ParsedURLStringTag, const String& url) breaks with ...
Simon Hausmann
Reported 2011-12-06 02:03:52 PST
http://trac.webkit.org/changeset/101713 changed the behaviour of calling KURL::KURL(ParsedURLStringTag, const String& url) with a null string, causing ASSERT(url == m_string); to fail. Example backtrace: Program received signal SIGSEGV, Segmentation fault. 0x00007ffff3863fca in WebCore::KURL::KURL (this=0x7fffffffc370, url=...) at /home/shausman/src/webkit/trunk/Source/WebCore/platform/KURL.cpp:334 334 ASSERT(url == m_string); (gdb) bt #0 0x00007ffff3863fca in WebCore::KURL::KURL (this=0x7fffffffc370, url=...) at /home/shausman/src/webkit/trunk/Source/WebCore/platform/KURL.cpp:334 #1 0x00007ffff7988f22 in CoreIPC::ArgumentCoder<WebCore::ResourceResponse>::decode (decoder=0x7db120, resourceResponse=...) at /home/shausman/src/webkit/trunk/Source/WebKit2/Shared/qt/WebCoreArgumentCodersQt.cpp:74 #2 0x00007ffff795f18b in CoreIPC::ArgumentDecoder::decode<WebCore::ResourceResponse> (this=0x7db120, t=...) at ../../../../Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h:89 #3 0x00007ffff7b6cc12 in CoreIPC::Arguments4<unsigned long, unsigned long, WebCore::ResourceRequest, WebCore::ResourceResponse>::decode (decoder=0x7db120, result=...) at ../../../../Source/WebKit2/Platform/CoreIPC/Arguments.h:203 #4 0x00007ffff7b6bf52 in CoreIPC::ArgumentCoder<CoreIPC::Arguments4<unsigned long, unsigned long, WebCore::ResourceRequest, WebCore::ResourceResponse> >::decode (decoder=0x7db120, t=...) at ../../../../Source/WebKit2/Platform/CoreIPC/ArgumentCoder.h:44 #5 0x00007ffff7b69dfd in CoreIPC::ArgumentDecoder::decode<CoreIPC::Arguments4<unsigned long, unsigned long, WebCore::ResourceRequest, WebCore::ResourceResponse> > (this=0x7db120, t=...) at ../../../../Source/WebKit2/Platform/CoreIPC/ArgumentDecoder.h:89 #6 0x00007ffff7b66234 in CoreIPC::handleMessage<Messages::WebPageProxy::DidSendRequestForResource, WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(unsigned long, unsigned long, WebCore::ResourceRequest const&, WebCore::ResourceResponse const&)> (argumentDecoder=0x7db120, object=0x7fff9c001760, function= This patch in the original change - m_string = originalString ? *originalString : url; + m_string = !originalString.isNull() ? originalString : url; now causes m_string to be assigned to url instead of originalString in this case. url was allocated in KURL::parse(const String& string) and is non-null, causing KURL::m_string to be an _empty_ string (with impl pointer) and originalString remaining the null string passed to the KURL constructor. Hence the failing assertion. It seems that the fix is to just use m_string = originalString; instead of the !originalString.isNull() ? originalString : url; snippet.
Attachments
REGRESSION(r101713): KURL(ParsedURLStringTag, const String& url) breaks with null strings (3.21 KB, patch)
2011-12-06 02:08 PST, Simon Hausmann
benjamin: review-
Simon Hausmann
Comment 1 2011-12-06 02:08:41 PST
Created attachment 118010 [details] REGRESSION(r101713): KURL(ParsedURLStringTag, const String& url) breaks with null strings
Benjamin Poulain
Comment 2 2011-12-06 02:20:43 PST
*** This bug has been marked as a duplicate of bug 73874 ***
Benjamin Poulain
Comment 3 2011-12-06 02:21:37 PST
Comment on attachment 118010 [details] REGRESSION(r101713): KURL(ParsedURLStringTag, const String& url) breaks with null strings This is a bad idea, you can have an url, and no originalString. 73874 isn't great either but that will do for now.
Benjamin Poulain
Comment 4 2011-12-06 02:22:26 PST
By the way, 73874 miss a test. It would be nice if you have one! :)
Note You need to log in before you can comment on or make changes to this bug.