Handle very large url pattern input#52836
Conversation
|
EWS run on previous version of this PR (hash 1864a72) Details
|
|
The test could use |
1864a72 to
8b6fc1e
Compare
|
EWS run on previous version of this PR (hash 8b6fc1e) Details
|
|
I wonder if it's helpful to implement add a cap / max_url_length for the input length as well. That way we can immediately reject longer URL's without having to perform these additional append operations and increasing stack usage to see if it will eventually fail. I think I saw somewhere that the max URL length that Safari supports is ~80K characters. EDIT: Chatted offline with Roberto and it looks like there is no maximum cap for URL's. Disregard this comment :) |
| debug("Attemping to set large string as input to URLPattern..."); | ||
| let urlPattern = new URLPattern(largeString); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Nit: A test description might be helpful.
test(function() { }, " .. test description here ..");
| <html> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <script src="../../resources/js-test-pre.js"></script> |
There was a problem hiding this comment.
I don't think you need the js-test-pre/post with testharness.js
8b6fc1e to
bd864bf
Compare
|
EWS run on previous version of this PR (hash bd864bf) Details |
bd864bf to
df19ca3
Compare
|
EWS run on current version of this PR (hash df19ca3) Details |
https://bugs.webkit.org/show_bug.cgi?id=301302 rdar://163099884 Reviewed by Ryosuke Niwa and Matthieu Dubet. When creating a URLPattern with a string as an input, it is possible to create it with a string so large that the underlying token list (vector) will intentionally crash when performing an append operation and the capacity cannot be increased. Check the result of each token append operation and throw an exception if an append cannot be performed. Test: fast/dom/DOMURL/url-pattern-very-large-string.html * LayoutTests/fast/dom/DOMURL/url-pattern-very-large-string-expected.txt: Added. * LayoutTests/fast/dom/DOMURL/url-pattern-very-large-string.html: Added. * Source/WebCore/Modules/url-pattern/URLPatternTokenizer.cpp: (WebCore::URLPatternUtilities::Tokenizer::addToken): (WebCore::URLPatternUtilities::Tokenizer::tokenize): * Source/WebCore/Modules/url-pattern/URLPatternTokenizer.h: Canonical link: https://commits.webkit.org/302131@main
df19ca3 to
f5e47e0
Compare
|
Committed 302131@main (f5e47e0): https://commits.webkit.org/302131@main Reviewed commits have been landed. Closing PR #52836 and removing active labels. |
🧪 api-mac
f5e47e0
df19ca3
🧪 ios-wk2-wpt