RESOLVED FIXED 239255
StorageMap::importItems may update currentSize wrongly in release build
https://bugs.webkit.org/show_bug.cgi?id=239255
Summary StorageMap::importItems may update currentSize wrongly in release build
Sihui Liu
Reported 2022-04-12 14:53:52 PDT
...
Attachments
Patch (2.67 KB, patch)
2022-04-12 15:21 PDT, Sihui Liu
ews-feeder: commit-queue-
Patch (2.77 KB, patch)
2022-04-12 15:58 PDT, Sihui Liu
no flags
Patch (2.54 KB, patch)
2022-04-13 10:00 PDT, Sihui Liu
no flags
Patch (2.52 KB, patch)
2022-04-13 10:14 PDT, Sihui Liu
no flags
Patch (2.56 KB, patch)
2022-04-13 10:29 PDT, Sihui Liu
no flags
Sihui Liu
Comment 1 2022-04-12 15:21:35 PDT
Sihui Liu
Comment 2 2022-04-12 15:58:19 PDT
Chris Dumez
Comment 3 2022-04-12 16:01:37 PDT
Comment on attachment 457486 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=457486&action=review > Source/WebCore/storage/StorageMap.cpp:166 > + RELEASE_LOG_ERROR(Storage, "StorageMap::importItems failed to import because map is not empty"); Why is it OK to ignore the items in this case? If that's not supposed to happen, should we ASSERT?
Sihui Liu
Comment 4 2022-04-13 09:54:41 PDT
(In reply to Chris Dumez from comment #3) > Comment on attachment 457486 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=457486&action=review > > > Source/WebCore/storage/StorageMap.cpp:166 > > + RELEASE_LOG_ERROR(Storage, "StorageMap::importItems failed to import because map is not empty"); > > Why is it OK to ignore the items in this case? If that's not supposed to > happen, should we ASSERT? Yes, we can turn it into assertion
Sihui Liu
Comment 5 2022-04-13 10:00:33 PDT
Chris Dumez
Comment 6 2022-04-13 10:08:51 PDT
Comment on attachment 457539 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=457539&action=review > Source/WebCore/storage/StorageMap.cpp:166 > + CheckedUint32 newSize = m_impl->currentSize; why `= m_impl->currentSize`? I thought the map was empty? Can we assert that m_impl->currentSize is 0 and then just use `CheckedUint32 newSize;` here?
Sihui Liu
Comment 7 2022-04-13 10:14:47 PDT
Chris Dumez
Comment 8 2022-04-13 10:16:32 PDT
Comment on attachment 457542 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=457542&action=review r=me assuming the bots are happy. > Source/WebCore/storage/StorageMap.cpp:164 > + RELEASE_ASSERT(!m_impl->currentSize); Why did you drop the `RELEASE_ASSERT(m_impl->map.isEmpty());` ? I feel it'd be good to check that both there is no item in the map and the size is indeed 0.
Sihui Liu
Comment 9 2022-04-13 10:27:49 PDT
Comment on attachment 457542 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=457542&action=review >> Source/WebCore/storage/StorageMap.cpp:164 >> + RELEASE_ASSERT(!m_impl->currentSize); > > Why did you drop the `RELEASE_ASSERT(m_impl->map.isEmpty());` ? > > I feel it'd be good to check that both there is no item in the map and the size is indeed 0. I thought you mean replacing RELEASE_ASSERT with this... will update.
Sihui Liu
Comment 10 2022-04-13 10:29:03 PDT
EWS
Comment 11 2022-04-13 15:45:13 PDT
Committed r292836 (249609@main): <https://commits.webkit.org/249609@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 457543 [details].
Radar WebKit Bug Importer
Comment 12 2022-04-13 15:46:16 PDT
Note You need to log in before you can comment on or make changes to this bug.