Title: [287048] trunk/Source/WebCore
Revision
287048
Author
[email protected]
Date
2021-12-14 14:15:49 -0800 (Tue, 14 Dec 2021)

Log Message

Adhere to DisplayList iterator's API contract in MemoryDisplayList::~InMemoryDisplayList()
https://bugs.webkit.org/show_bug.cgi?id=234264

Patch by Gabriel Nava Marino <[email protected]> on 2021-12-14
Reviewed by Myles C. Maxfield.

The client is not adhearing to the DisplayList Iterator's API contract in MemoryDisplayList::~InMemoryDisplayList():
"Part of the iterator's API contract is that if the item is nullopt, you're not allowed to keep
iterating - doing this will lead to an infinite loop."

Here we now do so by breaking out of iteration if the item is nullopt.

* platform/graphics/displaylists/InMemoryDisplayList.cpp:
(WebCore::DisplayList::InMemoryDisplayList::~InMemoryDisplayList):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (287047 => 287048)


--- trunk/Source/WebCore/ChangeLog	2021-12-14 22:10:59 UTC (rev 287047)
+++ trunk/Source/WebCore/ChangeLog	2021-12-14 22:15:49 UTC (rev 287048)
@@ -1,3 +1,19 @@
+2021-12-14  Gabriel Nava Marino  <[email protected]>
+
+        Adhere to DisplayList iterator's API contract in MemoryDisplayList::~InMemoryDisplayList()
+        https://bugs.webkit.org/show_bug.cgi?id=234264
+
+        Reviewed by Myles C. Maxfield.
+
+        The client is not adhearing to the DisplayList Iterator's API contract in MemoryDisplayList::~InMemoryDisplayList():
+        "Part of the iterator's API contract is that if the item is nullopt, you're not allowed to keep
+        iterating - doing this will lead to an infinite loop."
+
+        Here we now do so by breaking out of iteration if the item is nullopt.
+
+        * platform/graphics/displaylists/InMemoryDisplayList.cpp:
+        (WebCore::DisplayList::InMemoryDisplayList::~InMemoryDisplayList):
+
 2021-12-14  Alan Bujtas  <[email protected]>
 
         [LFC] Let BoxGeometry have logical values only

Modified: trunk/Source/WebCore/platform/graphics/displaylists/InMemoryDisplayList.cpp (287047 => 287048)


--- trunk/Source/WebCore/platform/graphics/displaylists/InMemoryDisplayList.cpp	2021-12-14 22:10:59 UTC (rev 287047)
+++ trunk/Source/WebCore/platform/graphics/displaylists/InMemoryDisplayList.cpp	2021-12-14 22:15:49 UTC (rev 287048)
@@ -63,6 +63,8 @@
 {
     auto end = this->end();
     for (auto displayListItem : *this) {
+        if (!displayListItem)
+            break;
         auto item = displayListItem->item;
         ASSERT(item);
         if (!item)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to