[WinCairo][WebKitTestRunner] Null dereference of GraphicsContext::m_data in GraphicsC...
authorHironori.Fujii@sony.com <Hironori.Fujii@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2019 01:13:44 +0000 (01:13 +0000)
committerHironori.Fujii@sony.com <Hironori.Fujii@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2019 01:13:44 +0000 (01:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193664

Reviewed by Brent Fulgham.

WinCairo WebKitTestRunner always crash on openning test cases of
HTMLMeterElement.

If GraphicsContext::getWindowsContext retruned null HDC,
LocalWindowsContext shouldn't release the null HDC.

Covered by existing tests.

* platform/graphics/win/LocalWindowsContext.h:
(WebCore::LocalWindowsContext::~LocalWindowsContext):
Release m_hdc only if it isn't null.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/win/LocalWindowsContext.h

index 2a25fc9..757c0fa 100644 (file)
@@ -1,3 +1,22 @@
+2019-01-22  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        [WinCairo][WebKitTestRunner] Null dereference of GraphicsContext::m_data in GraphicsContext::releaseWindowsContext
+        https://bugs.webkit.org/show_bug.cgi?id=193664
+
+        Reviewed by Brent Fulgham.
+
+        WinCairo WebKitTestRunner always crash on openning test cases of
+        HTMLMeterElement.
+
+        If GraphicsContext::getWindowsContext retruned null HDC,
+        LocalWindowsContext shouldn't release the null HDC.
+
+        Covered by existing tests.
+
+        * platform/graphics/win/LocalWindowsContext.h:
+        (WebCore::LocalWindowsContext::~LocalWindowsContext):
+        Release m_hdc only if it isn't null.
+
 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         Unreviewed, fix -Wsign-compare warning
index 93450ef..e2bf1d1 100644 (file)
@@ -43,7 +43,8 @@ public:
 
     ~LocalWindowsContext()
     {
-        m_graphicsContext.releaseWindowsContext(m_hdc, m_rect, m_supportAlphaBlend);
+        if (m_hdc)
+            m_graphicsContext.releaseWindowsContext(m_hdc, m_rect, m_supportAlphaBlend);
     }
 
     HDC hdc() const { return m_hdc; }