Title: [277854] trunk/Source/WebCore
Revision
277854
Author
commit-qu...@webkit.org
Date
2021-05-21 04:48:17 -0700 (Fri, 21 May 2021)

Log Message

Detect invalid InlinePathData in FillInlinePath
https://bugs.webkit.org/show_bug.cgi?id=225693

Patch by Rob Buis <rb...@igalia.com> on 2021-05-21
Reviewed by Ryosuke Niwa.

Detect invalid InlinePathData in FillInlinePath.

* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::InlinePathDataStorage::InlinePathDataStorage):
(WebCore::DisplayList::InlinePathDataStorage::isValid const):
(WebCore::DisplayList::FillInlinePath::FillInlinePath):
(WebCore::DisplayList::FillInlinePath::path const): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (277853 => 277854)


--- trunk/Source/WebCore/ChangeLog	2021-05-21 10:16:11 UTC (rev 277853)
+++ trunk/Source/WebCore/ChangeLog	2021-05-21 11:48:17 UTC (rev 277854)
@@ -1,3 +1,18 @@
+2021-05-21  Rob Buis  <rb...@igalia.com>
+
+        Detect invalid InlinePathData in FillInlinePath
+        https://bugs.webkit.org/show_bug.cgi?id=225693
+
+        Reviewed by Ryosuke Niwa.
+
+        Detect invalid InlinePathData in FillInlinePath.
+
+        * platform/graphics/displaylists/DisplayListItems.h:
+        (WebCore::DisplayList::InlinePathDataStorage::InlinePathDataStorage):
+        (WebCore::DisplayList::InlinePathDataStorage::isValid const):
+        (WebCore::DisplayList::FillInlinePath::FillInlinePath):
+        (WebCore::DisplayList::FillInlinePath::path const): Deleted.
+
 2021-05-21  Sam Sneddon  <gsnedd...@apple.com>
 
         Fix Python 3.6+ DeprecationWarnings about unknown escapes

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h (277853 => 277854)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2021-05-21 10:16:11 UTC (rev 277853)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2021-05-21 11:48:17 UTC (rev 277854)
@@ -1823,26 +1823,45 @@
 
 #if ENABLE(INLINE_PATH_DATA)
 
-class FillInlinePath {
+class InlinePathDataStorage {
 public:
+    InlinePathDataStorage(const InlinePathData& pathData)
+    {
+        if (pathData.index() >= 0 && static_cast<size_t>(pathData.index()) < WTF::variant_size<InlinePathData>::value)
+            m_pathData = pathData;
+        else {
+            auto moved = WTFMove(m_pathData);
+            UNUSED_VARIABLE(moved);
+        }
+    }
+
+    bool isValid() const { return !m_pathData.valueless_by_exception(); }
+
+    Path path() const { return Path::from(m_pathData); }
+
+protected:
+    InlinePathData m_pathData;
+};
+
+class FillInlinePath : public InlinePathDataStorage {
+public:
     static constexpr ItemType itemType = ItemType::FillInlinePath;
     static constexpr bool isInlineItem = true;
     static constexpr bool isDrawingItem = true;
 
+    FillInlinePath(const FillInlinePath& other)
+        : InlinePathDataStorage(other.m_pathData)
+    {
+    }
     FillInlinePath(const InlinePathData& pathData)
-        : m_pathData(pathData)
+        : InlinePathDataStorage(pathData)
     {
     }
 
-    Path path() const { return Path::from(m_pathData); }
-
     void apply(GraphicsContext&) const;
 
     Optional<FloatRect> globalBounds() const { return WTF::nullopt; }
     Optional<FloatRect> localBounds(const GraphicsContext&) const { return path().fastBoundingRect(); }
-
-private:
-    InlinePathData m_pathData;
 };
 
 #endif // ENABLE(INLINE_PATH_DATA)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to