Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(868)

Unified Diff: net/websockets/websocket_extension_parser_test.cc

Issue 2344873002: WebSocketExtensionParser: reject top-bit-set characters (Closed)
Patch Set: Include logging.h, remove string_util.h Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/websockets/websocket_extension_parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_extension_parser_test.cc
diff --git a/net/websockets/websocket_extension_parser_test.cc b/net/websockets/websocket_extension_parser_test.cc
index b0a2be9e87afd253a3b1c33513615a3f18448717..f726b3e1a391ba46658a50972ea4c51dd7e0e017 100644
--- a/net/websockets/websocket_extension_parser_test.cc
+++ b/net/websockets/websocket_extension_parser_test.cc
@@ -131,10 +131,15 @@ TEST(WebSocketExtensionParserTest, InvalidPatterns) {
"foo; bar=\"\"", // quoted empty parameter value
"foo; bar=\"baz", // unterminated quoted string
"foo; bar=\"baz \"", // space in quoted string
- "foo; bar baz", // mising '='
+ "foo; bar baz", // missing '='
"foo; bar - baz", // '-' instead of '=' (note: "foo; bar-baz" is valid).
"foo; bar=\r\nbaz", // CRNL not followed by a space
"foo; bar=\r\n baz", // CRNL followed by a space
+ "f\xFFpp", // 8-bit character in extension name
+ "foo; b\xFFr=baz" // 8-bit character in parameter name
+ "foo; bar=b\xFF" // 8-bit character in parameter value
+ "foo; bar=\"b\xFF\"" // 8-bit character in quoted parameter value
+ "foo; bar=\"baz\\" // ends with backslash
};
for (size_t i = 0; i < arraysize(patterns); ++i) {
@@ -155,6 +160,13 @@ TEST(WebSocketExtensionParserTest, QuotedParameterValue) {
EXPECT_TRUE(expected.Equals(parser.extensions()[0]));
}
+// This is a regression test for crbug.com/647156
+TEST(WebSocketExtensionParserTest, InvalidToken) {
+ static const char kInvalidInput[] = "\304;\304!*777\377=\377\254\377";
+ WebSocketExtensionParser parser;
+ EXPECT_FALSE(parser.Parse(kInvalidInput));
+}
+
} // namespace
} // namespace net
« no previous file with comments | « net/websockets/websocket_extension_parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698