Bug 57209

Summary: Assigning location.path to something that doesn't start with / mangles the authority
Product: WebKit Reporter: Maciej Stachowiak <mjs>
Component: New BugsAssignee: Maciej Stachowiak <mjs>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Attachments:
Description Flags
Patch mitz: review+

Maciej Stachowiak
Reported 2011-03-28 00:25:25 PDT
Assigning location.path to something that doesn't start with / mangles the authority
Attachments
Patch (5.60 KB, patch)
2011-03-28 00:26 PDT, Maciej Stachowiak
mitz: review+
Maciej Stachowiak
Comment 1 2011-03-28 00:26:31 PDT
Adam Barth
Comment 2 2011-03-28 01:00:45 PDT
Comment on attachment 87108 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=87108&action=review > Source/WebCore/platform/KURL.cpp:864 > + if (path.length() < 1 || path[0] != '/') > + path = "/" + path; I'd just test for path.isEmpty() instead of path.length() < 1.
Maciej Stachowiak
Comment 3 2011-03-28 02:34:30 PDT
Darin Adler
Comment 4 2011-03-28 08:51:04 PDT
Comment on attachment 87108 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=87108&action=review >> Source/WebCore/platform/KURL.cpp:864 >> + path = "/" + path; > > I'd just test for path.isEmpty() instead of path.length() < 1. Since string subscripting does a length check, there is no need to check path.length() or path.isEmpty(). The value path[0] will be 0 if the path is empty.
Note You need to log in before you can comment on or make changes to this bug.