Bug 44461 - Assertion failure at WebCore/platform/network/CredentialStorage.cpp:85.
Summary: Assertion failure at WebCore/platform/network/CredentialStorage.cpp:85.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-23 16:05 PDT by Yongjun Zhang
Modified: 2016-01-22 14:28 PST (History)
9 users (show)

See Also:


Attachments
Attach the callstack when assertion failure happens. (9.36 KB, text/plain)
2010-08-23 16:08 PDT, Yongjun Zhang
no flags Details
remove redundant forward slashes. (3.75 KB, patch)
2010-08-23 17:38 PDT, Yongjun Zhang
no flags Details | Formatted Diff | Diff
remove redundant forward slashes. (add new line at end of test file). (3.72 KB, patch)
2010-08-23 17:42 PDT, Yongjun Zhang
ap: review+
ap: commit-queue-
Details | Formatted Diff | Diff
Remove the assertion because it is legal to have multiple trailing slashes after the path component. (1.38 KB, patch)
2010-08-24 12:27 PDT, Yongjun Zhang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yongjun Zhang 2010-08-23 16:05:59 PDT
WebCore hits assertion failure at /WebCore/platform/network/CredentialStorage.cpp:85 when the url has double slash as folder separator.  For example, "http://foo.com/bar//test.htm".
Comment 1 Yongjun Zhang 2010-08-23 16:08:02 PDT
Created attachment 65171 [details]
Attach the callstack when assertion failure happens.
Comment 2 Yongjun Zhang 2010-08-23 17:38:52 PDT
Created attachment 65188 [details]
remove redundant forward slashes.

 Remove redundant forward slashes in directoryURL even though multiple slashes are valid in URL.  This fixes the assertion failure and possible protectionSpace mapping failure when two URLs differ only on redundant slashes and they are essentially the same.
Comment 3 Yongjun Zhang 2010-08-23 17:42:15 PDT
Created attachment 65189 [details]
remove redundant forward slashes. (add new line at end of test file).
Comment 4 Alexey Proskuryakov 2010-08-23 18:30:10 PDT
Comment on attachment 65189 [details]
remove redundant forward slashes. (add new line at end of test file).

> even though multiple slashes are valid in URL

I'm not really sure on the status of this validity. In file paths, multiple slashes always mean the same as a single one, but I think that in URLs, it's up to the server to make a decision. This thought is what has been preventing from fixing this myself.

I guess it's fine for us to do whatever Firefox is doing, and if it normalizes slashes before looking up a directory for stored credentials, so could we. But this patch doesn't quite implement that, as it only removes trailing slashes.

 +        while (index > 0 && directoryURL[index-1] == '/')

There should be spaces around "-".

> +            index--;

There is no practical difference for integer values, but for consistency with iterators, it's best to always use prefix increment and decrement. When the compiler cannot optimize it, postfix variants create temporary copies.

> +    xhr.open("GET", "resources/remember-bad-password//count-failures.php", false);

Ideally, the test would check the response to make sure that mapping doesn't fail (and it should pass in Firefox).

r=me.
Comment 5 Alexey Proskuryakov 2010-08-23 18:43:39 PDT
Comment on attachment 65189 [details]
remove redundant forward slashes. (add new line at end of test file).

I expected at least the style issue to be fixed.
Comment 6 Yongjun Zhang 2010-08-23 21:10:20 PDT
(In reply to comment #5)
> (From update of attachment 65189 [details])
> I expected at least the style issue to be fixed.

sorry, I misread your comments.  New patch coming.
Comment 7 Yongjun Zhang 2010-08-24 12:26:03 PDT
I did some test with the assertion removed, and it turns out the assumption in my original patch is wrong.  For a URL with double-slash path, it will create another entry in PathToDefaultProtectionSpaceMap along with the URL with single-slash path.  So the query in HashMap will fail.  But it doesn't affect the authentication because http servers will handle it correctly.

Since it is perfectly legal to have multiple slash following the path, I believe we should remove the assertion or come up with a new one which accepts trailing slashes.
Comment 8 Yongjun Zhang 2010-08-24 12:27:34 PDT
Created attachment 65307 [details]
Remove the assertion because it is legal to have multiple trailing slashes after the path component.
Comment 9 Alexey Proskuryakov 2010-08-24 12:43:09 PDT
Comment on attachment 65307 [details]
Remove the assertion because it is legal to have multiple trailing slashes after the path component.

OK
Comment 10 Yongjun Zhang 2010-08-24 13:31:32 PDT
(In reply to comment #9)
> (From update of attachment 65307 [details])
> OK

Thanks!
Comment 11 WebKit Commit Bot 2010-08-25 04:37:17 PDT
Comment on attachment 65307 [details]
Remove the assertion because it is legal to have multiple trailing slashes after the path component.

Clearing flags on attachment: 65307

Committed r66005: <http://trac.webkit.org/changeset/66005>
Comment 12 WebKit Review Bot 2010-08-25 05:15:01 PDT
http://trac.webkit.org/changeset/66005 might have broken SnowLeopard Intel Release (Tests)
Comment 13 Alexey Proskuryakov 2010-08-25 09:39:46 PDT
No way, all it did was remove an assertion.
Comment 14 Adam Barth 2010-08-25 09:42:22 PDT
(In reply to comment #13)
> No way, all it did was remove an assertion.

The SL bots are super flaky.  There are tests that fail on one of the slaves but not the other.  :-/
Comment 15 Eric Seidel (no email) 2010-09-15 00:19:03 PDT
This looks landed.