Conversation
… playback and RWI https://bugs.webkit.org/show_bug.cgi?id=284108 Reviewed by Devin Rousso. When WebInspector is used, the downloaded data is cached also for it in NetworkResourcesData. The single resource data cannot be greater than maximumSingleResourceContentSize (50MB) and the total size of resources content cannot be greater than maximumResourcesContentSize (200MB). At the end of downloading the resource, the binary data is decoded to the string represantation (base64 or other depends on decoder). Decoding process can increased the size of the kept resource data. The limit maximumSingleResourceContentSize is checked but maximumResourcesContentSize limit is not checked which can lead to situation that m_contentSize (the total size of resources content) is greater than maximumResourcesContentSize. This causes that condition checked in NetworkResourcesData::ensureFreeSpace is invalid because subtraction unsigned values where first value(minuend) is smaller than the second one(subtrahend) gives a huge number (instead of negative number). This change ensures that after decoding binary data into string representation the total size of resources content (m_contentSize) is not greater than maximumResourcesContentSize. The assert is added in NetworkResourcesData::ensureFreeSpace to check that m_contentSize is not greater than maximumResourcesContentSize. I fixed implementation of function NetworkResourcesData::clear in case passing the preservedLoaderId. In that case we should update m_requestIdsDeque and m_contentSize and not just clear them. Additionally I changed the type of m_requestIdsDeque from Deque<String> to ListHashSet<String>. This change fixes adding to m_requestIdsDeque the same requestId many times. * Source/WebCore/inspector/NetworkResourcesData.cpp: (WebCore::NetworkResourcesData::ResourceData::decodeDataToContent): (WebCore::NetworkResourcesData::setResourceContent): (WebCore::NetworkResourcesData::maybeAddResourceData): (WebCore::NetworkResourcesData::maybeDecodeDataToContent): (WebCore::NetworkResourcesData::clear): (WebCore::NetworkResourcesData::ensureFreeSpace): * Source/WebCore/inspector/NetworkResourcesData.h: Canonical link: https://commits.webkit.org/289143@main
magomez
approved these changes
Jan 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… playback and RWI
https://bugs.webkit.org/show_bug.cgi?id=284108
Reviewed by Devin Rousso.
When WebInspector is used, the downloaded data is cached also for it in NetworkResourcesData. The single resource data cannot be greater than maximumSingleResourceContentSize (50MB) and the total size of resources content cannot be greater than maximumResourcesContentSize (200MB). At the end of downloading the resource, the binary data is decoded to the string represantation (base64 or other depends on decoder). Decoding process can increased the size of the kept resource data. The limit maximumSingleResourceContentSize is checked but maximumResourcesContentSize limit is not checked which can lead to situation that m_contentSize (the total size of resources content) is greater than maximumResourcesContentSize. This causes that condition checked in NetworkResourcesData::ensureFreeSpace is invalid because subtraction unsigned values where first value(minuend) is smaller than the second one(subtrahend) gives a huge number (instead of negative number).
This change ensures that after decoding binary data into string representation the total size of resources content (m_contentSize) is not greater than maximumResourcesContentSize. The assert is added in NetworkResourcesData::ensureFreeSpace to check that m_contentSize is not greater than maximumResourcesContentSize.
I fixed implementation of function NetworkResourcesData::clear in case passing the preservedLoaderId. In that case we should update m_requestIdsDeque and m_contentSize and not just clear them.
Additionally I changed the type of m_requestIdsDeque from Deque to ListHashSet. This change fixes adding to m_requestIdsDeque the same requestId many times.
(WebCore::NetworkResourcesData::ensureFreeSpace):
Canonical link: https://commits.webkit.org/289143@main
2b42028
🧪 wpe-238-amd64-layout🧪 wpe-238-arm32-layout