Bug 73896 - REGRESSION(r101713): KURL(ParsedURLStringTag, const String& url) breaks with null strings
Summary: REGRESSION(r101713): KURL(ParsedURLStringTag, const String& url) breaks with ...
Status: RESOLVED DUPLICATE of bug 73874
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-06 02:03 PST by Simon Hausmann
Modified: 2011-12-06 02:22 PST (History)
2 users (show)

See Also:


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-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Hausmann 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.
Comment 1 Simon Hausmann 2011-12-06 02:08:41 PST
Created attachment 118010 [details]
REGRESSION(r101713): KURL(ParsedURLStringTag, const String& url) breaks with null strings
Comment 2 Benjamin Poulain 2011-12-06 02:20:43 PST

*** This bug has been marked as a duplicate of bug 73874 ***
Comment 3 Benjamin Poulain 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.
Comment 4 Benjamin Poulain 2011-12-06 02:22:26 PST
By the way, 73874 miss a test. It would be nice if you have one! :)