REGRESSION(r140344): Repeated crashes in WKTR PlatformWebView::viewSupportsOptions().
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Jan 2013 19:13:58 +0000 (19:13 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Jan 2013 19:13:58 +0000 (19:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=107562

Rubber-stamped by Alexy Proskuryakov.

The input to WKBooleanGetValue() is not NULL-safe, so NULL check its inputs before calling.

* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
(WTR::PlatformWebView::viewSupportsOptions):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140442 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm

index 22f2258..248dd77 100644 (file)
@@ -1,3 +1,16 @@
+2013-01-22  Jer Noble  <jer.noble@apple.com>
+
+        REGRESSION(r140344): Repeated crashes in WKTR PlatformWebView::viewSupportsOptions().
+        https://bugs.webkit.org/show_bug.cgi?id=107562
+
+        Rubber-stamped by Alexy Proskuryakov.
+
+        The input to WKBooleanGetValue() is not NULL-safe, so NULL check its inputs before calling.
+
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (WTR::PlatformWebView::PlatformWebView):
+        (WTR::PlatformWebView::viewSupportsOptions):
+
 2013-01-22  Alexey Proskuryakov  <ap@apple.com>
 
         One is not allowed to use commit-queue to make oneself a committer.
index 4314b9a..98150b1 100644 (file)
@@ -109,7 +109,8 @@ PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGro
     : m_windowIsKey(true)
 {
     WKRetainPtr<WKStringRef> useTiledDrawingKey(AdoptWK, WKStringCreateWithUTF8CString("TiledDrawing"));
-    bool useTiledDrawing = options ? WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(options, useTiledDrawingKey.get()))) : false;
+    WKTypeRef useTiledDrawingValue = options ? WKDictionaryGetItemForKey(options, useTiledDrawingKey.get()) : NULL;
+    bool useTiledDrawing = useTiledDrawingValue && WKBooleanGetValue(static_cast<WKBooleanRef>(useTiledDrawingValue));
 
     NSRect rect = NSMakeRect(0, 0, 800, 600);
     m_view = [[TestRunnerWKView alloc] initWithFrame:rect contextRef:contextRef pageGroupRef:pageGroupRef useTiledDrawing:useTiledDrawing];
@@ -202,7 +203,8 @@ WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
 bool PlatformWebView::viewSupportsOptions(WKDictionaryRef options) const
 {
     WKRetainPtr<WKStringRef> useTiledDrawingKey(AdoptWK, WKStringCreateWithUTF8CString("TiledDrawing"));
-    bool useTiledDrawing = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(options, useTiledDrawingKey.get())));
+    WKTypeRef useTiledDrawingValue = WKDictionaryGetItemForKey(options, useTiledDrawingKey.get());
+    bool useTiledDrawing = useTiledDrawingValue && WKBooleanGetValue(static_cast<WKBooleanRef>(useTiledDrawingValue));
 
     return useTiledDrawing == [(TestRunnerWKView *)m_view useTiledDrawing];
 }