Changeset 228696 in webkit
- Timestamp:
- Feb 19, 2018 10:34:07 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r228691 r228696 1 2018-02-19 Daniel Bates <dabates@apple.com> 2 3 Null pointer dereference in WebPageProxy::urlSchemeHandlerForScheme() 4 https://bugs.webkit.org/show_bug.cgi?id=182905 5 6 Reviewed by Alex Christensen. 7 8 Return nullptr when querying for the scheme handler of the null string. 9 10 Before a navigation is performed WebKit checks if the destination URL is associated with an app 11 unless the embedding client overrides the WKNavigationDelegate delegate callback -webView:decidePolicyForNavigationAction:decisionHandler. 12 If the URL is not associated with an app then WebKit may fall back to checking if the embedding 13 client registered a scheme handler for it. Currently we assume that the scheme is a non-null 14 string when checking the scheme handler registry. However the scheme can be a null string if 15 it is part of a malformed URL. And this leads to bad news bears when we try to use it to look 16 for a scheme handler. Instead check that the scheme is a non-null string before checking to see 17 if it is in the scheme handler registry. 18 19 * UIProcess/WebPageProxy.cpp: 20 (WebKit::WebPageProxy::urlSchemeHandlerForScheme): 21 1 22 2018-02-19 Ms2ger <Ms2ger@igalia.com> 2 23 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r228587 r228696 7200 7200 WebURLSchemeHandler* WebPageProxy::urlSchemeHandlerForScheme(const String& scheme) 7201 7201 { 7202 return m_urlSchemeHandlersByScheme.get(scheme);7202 return scheme.isNull() ? nullptr : m_urlSchemeHandlersByScheme.get(scheme); 7203 7203 } 7204 7204 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm
r225645 r228696 562 562 } 563 563 564 @interface DecidePolicyForNavigationActionForMalformedURLDelegate : NSObject <WKNavigationDelegate> 565 @end 566 567 @implementation DecidePolicyForNavigationActionForMalformedURLDelegate 568 569 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation 570 { 571 finishedNavigation = true; 572 } 573 574 @end 575 576 TEST(WebKit, DecidePolicyForNavigationActionForMalformedURL) 577 { 578 auto webView = adoptNS([[WKWebView alloc] init]); 579 auto controller = adoptNS([[DecidePolicyForNavigationActionForMalformedURLDelegate alloc] init]); 580 [webView setNavigationDelegate:controller.get()]; 581 582 finishedNavigation = false; 583 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"N"]]]; 584 TestWebKitAPI::Util::run(&finishedNavigation); 585 } 586 564 587 #endif 565 588
Note: See TracChangeset
for help on using the changeset viewer.