diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-22 09:07:22 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-22 09:07:22 +0000 |
commit | 248fa6ff5b8f337efcdca19134f60c81bcac5113 (patch) | |
tree | d288181257f1311b3ad5b74f66cac327064438b4 /url | |
parent | d8a6c74f4c822edb36d3ef03932cae21c708ddfe (diff) | |
download | chromium_src-248fa6ff5b8f337efcdca19134f60c81bcac5113.zip chromium_src-248fa6ff5b8f337efcdca19134f60c81bcac5113.tar.gz chromium_src-248fa6ff5b8f337efcdca19134f60c81bcac5113.tar.bz2 |
Fix bug in GURL with self-assignment and non-NULL inner_url_
BUG=309975
R=darin@chromium.org
Review URL: https://codereview.chromium.org/32583006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230079 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'url')
-rw-r--r-- | url/gurl.cc | 3 | ||||
-rw-r--r-- | url/gurl_unittest.cc | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/url/gurl.cc b/url/gurl.cc index 229df5d..7997d22 100644 --- a/url/gurl.cc +++ b/url/gurl.cc @@ -169,6 +169,9 @@ GURL::~GURL() { } GURL& GURL::operator=(const GURL& other) { + if (&other == this) + return *this; + spec_ = other.spec_; is_valid_ = other.is_valid_; parsed_ = other.parsed_; diff --git a/url/gurl_unittest.cc b/url/gurl_unittest.cc index dbf2b96..ddb55d89 100644 --- a/url/gurl_unittest.cc +++ b/url/gurl_unittest.cc @@ -487,3 +487,10 @@ TEST(GURLTest, IsStandard) { GURL c("foo://bar/baz"); EXPECT_FALSE(c.IsStandard()); } + +// This is a regression test for http://crbug.com/309975 . +TEST(GURLTest, SelfAssignment) { + GURL a("filesystem:http://example.com/temporary/"); + // This should not crash. + a = a; +} |