Title: [276737] trunk/Source/WebCore
- Revision
- 276737
- Author
- [email protected]
- Date
- 2021-04-28 15:49:00 -0700 (Wed, 28 Apr 2021)
Log Message
Make sure we invalidate the iterator in StorageMap::clear()
https://bugs.webkit.org/show_bug.cgi?id=225164
Reviewed by Alex Christensen.
I recently introduced StorageMap::clear() but failed to call invalidateIterator()
like we do in other StorageMap functions that modify the internal HashMap. Since
we cleared the HashMap, we don't want to be keeping a HashMap iterator around.
Looking at the code, I do not think this can cause crashes because the
`index >= length()` check would fail in StorageMap::key(unsigned). That said, it
is best not to keep a bad iterator around.
* storage/StorageMap.cpp:
(WebCore::StorageMap::clear):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (276736 => 276737)
--- trunk/Source/WebCore/ChangeLog 2021-04-28 22:46:28 UTC (rev 276736)
+++ trunk/Source/WebCore/ChangeLog 2021-04-28 22:49:00 UTC (rev 276737)
@@ -1,3 +1,20 @@
+2021-04-28 Chris Dumez <[email protected]>
+
+ Make sure we invalidate the iterator in StorageMap::clear()
+ https://bugs.webkit.org/show_bug.cgi?id=225164
+
+ Reviewed by Alex Christensen.
+
+ I recently introduced StorageMap::clear() but failed to call invalidateIterator()
+ like we do in other StorageMap functions that modify the internal HashMap. Since
+ we cleared the HashMap, we don't want to be keeping a HashMap iterator around.
+ Looking at the code, I do not think this can cause crashes because the
+ `index >= length()` check would fail in StorageMap::key(unsigned). That said, it
+ is best not to keep a bad iterator around.
+
+ * storage/StorageMap.cpp:
+ (WebCore::StorageMap::clear):
+
2021-04-28 Wenson Hsieh <[email protected]>
Fine-tune some more selection behaviors in image overlays
Modified: trunk/Source/WebCore/storage/StorageMap.cpp (276736 => 276737)
--- trunk/Source/WebCore/storage/StorageMap.cpp 2021-04-28 22:46:28 UTC (rev 276736)
+++ trunk/Source/WebCore/storage/StorageMap.cpp 2021-04-28 22:49:00 UTC (rev 276737)
@@ -150,6 +150,7 @@
}
m_impl->map.clear();
m_impl->currentSize = 0;
+ invalidateIterator();
}
bool StorageMap::contains(const String& key) const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes