Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: third_party/WebKit/Source/platform/blob/BlobData.cpp

Issue 2717583003: [BlobStorage] Enforcing renderer constraints to prevent broken blobs (Closed)
Patch Set: moving to dchecks Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/blob/BlobData.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/blob/BlobData.cpp
diff --git a/third_party/WebKit/Source/platform/blob/BlobData.cpp b/third_party/WebKit/Source/platform/blob/BlobData.cpp
index d3285e23991301742f7e695e4058ee96d65ad9b9..699f20592b085aca6be0501f40df1cca3e2d9760 100644
--- a/third_party/WebKit/Source/platform/blob/BlobData.cpp
+++ b/third_party/WebKit/Source/platform/blob/BlobData.cpp
@@ -113,6 +113,11 @@ void BlobData::appendFile(const String& path,
double expectedModificationTime) {
CHECK_EQ(m_fileComposition, FileCompositionStatus::NO_UNKNOWN_SIZE_FILES)
pwnall 2017/02/28 23:37:03 This CHECK should also be a DCHECK, but it's not i
<< "Blobs with a unknown-size file cannot have other items.";
+ DCHECK_NE(length, BlobDataItem::toEndOfFile)
+ << "It is illegal to append file items that have an unknown size. To "
+ "create a blob with a single file with unknown size, use "
+ "BlobData::createForFileWithUnknownSize. Otherwise please provide the "
+ "file size.";
m_items.push_back(
BlobDataItem(path, offset, length, expectedModificationTime));
}
@@ -122,6 +127,8 @@ void BlobData::appendBlob(PassRefPtr<BlobDataHandle> dataHandle,
long long length) {
CHECK_EQ(m_fileComposition, FileCompositionStatus::NO_UNKNOWN_SIZE_FILES)
pwnall 2017/02/28 23:37:03 This CHECK should also be a DCHECK, same comment a
<< "Blobs with a unknown-size file cannot have other items.";
+ DCHECK(!dataHandle->isSingleUnknownSizeFile())
+ << "It is illegal to append an unknown size file blob.";
m_items.push_back(BlobDataItem(std::move(dataHandle), offset, length));
}
@@ -210,14 +217,17 @@ bool BlobData::canConsolidateData(size_t length) {
}
BlobDataHandle::BlobDataHandle()
- : m_uuid(createCanonicalUUIDString()), m_size(0) {
+ : m_uuid(createCanonicalUUIDString()),
+ m_size(0),
+ m_isSingleUnknownSizeFile(false) {
BlobRegistry::registerBlobData(m_uuid, BlobData::create());
}
BlobDataHandle::BlobDataHandle(std::unique_ptr<BlobData> data, long long size)
: m_uuid(createCanonicalUUIDString()),
m_type(data->contentType().isolatedCopy()),
- m_size(size) {
+ m_size(size),
+ m_isSingleUnknownSizeFile(data->isSingleUnknownSizeFile()) {
BlobRegistry::registerBlobData(m_uuid, std::move(data));
}
@@ -226,7 +236,8 @@ BlobDataHandle::BlobDataHandle(const String& uuid,
long long size)
: m_uuid(uuid.isolatedCopy()),
m_type(isValidBlobType(type) ? type.isolatedCopy() : ""),
- m_size(size) {
+ m_size(size),
+ m_isSingleUnknownSizeFile(false) {
BlobRegistry::addBlobDataRef(m_uuid);
}
« no previous file with comments | « third_party/WebKit/Source/platform/blob/BlobData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698