RESOLVED FIXED 161443
URLParser should handle . and .. in URL paths
https://bugs.webkit.org/show_bug.cgi?id=161443
Summary URLParser should handle . and .. in URL paths
Alex Christensen
Reported 2016-08-31 11:23:31 PDT
URLParser should handle . and .. in URL paths
Attachments
Patch (16.21 KB, patch)
2016-08-31 11:23 PDT, Alex Christensen
no flags
Patch (16.21 KB, patch)
2016-08-31 14:27 PDT, Alex Christensen
no flags
Patch (16.26 KB, patch)
2016-09-01 11:56 PDT, Alex Christensen
no flags
Patch (16.40 KB, patch)
2016-09-01 12:47 PDT, Alex Christensen
beidson: review+
Alex Christensen
Comment 1 2016-08-31 11:23:58 PDT
WebKit Commit Bot
Comment 2 2016-08-31 11:40:48 PDT
Attachment 287522 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Alex Christensen
Comment 3 2016-08-31 14:27:31 PDT
Alex Christensen
Comment 4 2016-09-01 11:56:34 PDT
Brady Eidson
Comment 5 2016-09-01 12:07:29 PDT
Comment on attachment 287543 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=287543&action=review > Source/WebCore/platform/URLParser.cpp:152 > +static bool isSingleDotPathSegment(StringView::CodePoints::Iterator c, const StringView::CodePoints::Iterator& end) > +{ > + if (c == end) > + return false; > + if (*c == '.') { > + ++c; > + return c == end || *c == '/' || *c == '\\' || *c == '?' || *c == '#'; > + } > + if (*c != '%') > + return false; > + ++c; > + if (c == end || *c != '2') > + return false; > + ++c; > + if (c == end) > + return false; > + if (*c == 'e' || *c == 'E') { > + ++c; > + return c == end || *c == '/' || *c == '\\' || *c == '?' || *c == '#'; > + } > + return false; > +} "2E" is a magic constant that should be more obvious. static const char dotASCIICode = "2E"; ? > Source/WebCore/platform/URLParser.cpp:171 > + if (c == end || *c != '2') > + return false; > + ++c; > + if (c == end) > + return false; > + if (*c == 'e' || *c == 'E') { > + ++c; Same magic constant comment. > Source/WebCore/platform/URLParser.cpp:194 > + ASSERT(*c == '%'); > + ++c; > + ASSERT(*c == '2'); > + ++c; > + ASSERT(*c == 'e' || *c == 'E'); > + ++c; Same comment you guessed it. > Source/WebCore/platform/URLParser.cpp:215 > + ASSERT(*c == '2'); > + ++c; > + ASSERT(*c == 'e' || *c == 'E'); > + ++c; > + } You guessed it.
Alex Christensen
Comment 6 2016-09-01 12:47:20 PDT
Alex Christensen
Comment 7 2016-09-01 13:35:40 PDT
Note You need to log in before you can comment on or make changes to this bug.