Changeset 225829 in webkit
- Timestamp:
- Dec 12, 2017 5:54:26 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r225828 r225829 1 2017-12-12 Alex Christensen <achristensen@webkit.org> 2 3 Fix possible out-of-bounds read in protocolIsInHTTPFamily 4 https://bugs.webkit.org/show_bug.cgi?id=180688 5 6 Reviewed by Daniel Bates. 7 8 It wouldn't read very far out of bounds, and it would just change a bool return value, 9 but it's still out of bounds. Covered by an API test that ASAN wouldn't like. 10 11 * platform/URL.cpp: 12 (WebCore::protocolIsInHTTPFamily): 13 Check bounds before reading a string. 14 1 15 2017-12-12 Youenn Fablet <youenn@apple.com> 2 16 -
trunk/Source/WebCore/platform/URL.cpp
r225662 r225829 874 874 bool protocolIsInHTTPFamily(const String& url) 875 875 { 876 auto length = url.length(); 876 877 // Do the comparison without making a new string object. 877 return isASCIIAlphaCaselessEqual(url[0], 'h') 878 return length >= 5 879 && isASCIIAlphaCaselessEqual(url[0], 'h') 878 880 && isASCIIAlphaCaselessEqual(url[1], 't') 879 881 && isASCIIAlphaCaselessEqual(url[2], 't') 880 882 && isASCIIAlphaCaselessEqual(url[3], 'p') 881 && (url[4] == ':' || (isASCIIAlphaCaselessEqual(url[4], 's') && url[5] == ':'));883 && (url[4] == ':' || (isASCIIAlphaCaselessEqual(url[4], 's') && length >= 6 && url[5] == ':')); 882 884 } 883 885 -
trunk/Tools/ChangeLog
r225824 r225829 1 2017-12-12 Alex Christensen <achristensen@webkit.org> 2 3 Fix possible out-of-bounds read in protocolIsInHTTPFamily 4 https://bugs.webkit.org/show_bug.cgi?id=180688 5 6 Reviewed by Daniel Bates. 7 8 * TestWebKitAPI/Tests/WebCore/URL.cpp: 9 (TestWebKitAPI::TEST_F): 10 1 11 2017-12-12 JF Bastien <jfbastien@apple.com> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/URL.cpp
r222093 r225829 214 214 } 215 215 216 TEST_F(URLTest, ProtocolIsInHTTPFamily) 217 { 218 EXPECT_FALSE(protocolIsInHTTPFamily({})); 219 EXPECT_FALSE(protocolIsInHTTPFamily("")); 220 EXPECT_FALSE(protocolIsInHTTPFamily("a")); 221 EXPECT_FALSE(protocolIsInHTTPFamily("ab")); 222 EXPECT_FALSE(protocolIsInHTTPFamily("abc")); 223 EXPECT_FALSE(protocolIsInHTTPFamily("abcd")); 224 EXPECT_FALSE(protocolIsInHTTPFamily("abcde")); 225 EXPECT_FALSE(protocolIsInHTTPFamily("abcdef")); 226 EXPECT_FALSE(protocolIsInHTTPFamily("abcdefg")); 227 EXPECT_TRUE(protocolIsInHTTPFamily("http:")); 228 EXPECT_FALSE(protocolIsInHTTPFamily("http")); 229 EXPECT_TRUE(protocolIsInHTTPFamily("https:")); 230 EXPECT_FALSE(protocolIsInHTTPFamily("https")); 231 EXPECT_TRUE(protocolIsInHTTPFamily("https://!@#$%^&*()")); 232 } 233 216 234 } // namespace TestWebKitAPI
Note: See TracChangeset
for help on using the changeset viewer.