Changeset 185442 in webkit
- Timestamp:
- Jun 10, 2015, 5:52:22 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/contentextensions/ContentExtensionError.cpp (modified) (1 diff)
-
Source/WebCore/contentextensions/ContentExtensionError.h (modified) (1 diff)
-
Source/WebCore/contentextensions/ContentExtensionParser.cpp (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r185438 r185442 1 2015-06-10 Alex Christensen <achristensen@webkit.org> 2 3 [Content Extensions] Limit number of rules. 4 https://bugs.webkit.org/show_bug.cgi?id=145663 5 rdar://problem/21242407 6 7 Reviewed by Benjamin Poulain. 8 9 Added an API test to make sure that parsing fails when there are too many rules. 10 11 * contentextensions/ContentExtensionError.cpp: 12 (WebCore::ContentExtensions::contentExtensionErrorCategory): 13 * contentextensions/ContentExtensionError.h: 14 * contentextensions/ContentExtensionParser.cpp: 15 (WebCore::ContentExtensions::loadEncodedRules): 16 Fail to parse a content extension with more than 50000 rules. 17 1 18 2015-06-10 Said Abou-Hallawa <sabouhallawa@apple.com> 2 19 -
trunk/Source/WebCore/contentextensions/ContentExtensionError.cpp
r184644 r185442 78 78 case ContentExtensionError::JSONInvalidDomainList: 79 79 return "Invalid domain list."; 80 case ContentExtensionError::JSONTooManyRules: 81 return "Too many rules in JSON array."; 80 82 case ContentExtensionError::JSONDomainNotLowerCaseASCII: 81 83 return "Domains must be lower case ASCII. Use punycode to encode non-ASCII characters."; -
trunk/Source/WebCore/contentextensions/ContentExtensionError.h
r184644 r185442 53 53 JSONDomainNotLowerCaseASCII, 54 54 JSONUnlessAndIfDomain, 55 JSONTooManyRules, 55 56 56 57 JSONInvalidAction, -
trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp
r184116 r185442 240 240 241 241 unsigned length = topLevelArray->length(); 242 const unsigned maxRuleCount = 50000; 243 if (length > maxRuleCount) 244 return ContentExtensionError::JSONTooManyRules; 242 245 for (unsigned i = 0; i < length; ++i) { 243 246 JSValue value = topLevelArray->getIndex(&exec, i); -
trunk/Tools/ChangeLog
r185405 r185442 1 2015-06-10 Alex Christensen <achristensen@webkit.org> 2 3 [Content Extensions] Make max NFA size and max rule count user defaults. 4 https://bugs.webkit.org/show_bug.cgi?id=145663 5 rdar://problem/21242407 6 7 Reviewed by Benjamin Poulain. 8 9 * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp: 10 (TestWebKitAPI::TEST_F): 11 1 12 2015-06-10 Hyungwook Lee <hyungwook.lee@navercorp.com> 2 13 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp
r185079 r185442 812 812 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"resource-type\":[5]}}]", 813 813 ContentExtensions::ContentExtensionError::JSONInvalidStringInTriggerFlagsArray); 814 815 StringBuilder rules; 816 rules.append("["); 817 for (unsigned i = 1; i < 50000; ++i) 818 rules.append("{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"a\"}},"); 819 String rules50000 = rules.toString() + "{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"a\"}}]"; 820 String rules50001 = rules.toString() + "{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"a\"}},{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"a\"}}]"; 821 checkCompilerError(rules50000.utf8().data(), { }); 822 checkCompilerError(rules50001.utf8().data(), ContentExtensions::ContentExtensionError::JSONTooManyRules); 814 823 815 824 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"if-domain\":{}}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList);
Note:
See TracChangeset
for help on using the changeset viewer.