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

Unified Diff: gpu/command_buffer/service/common_decoder.cc

Issue 822953002: Validate Bucket data in ShaderSourceBucket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added braces to error check. Created 5 years, 12 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 | « gpu/command_buffer/service/common_decoder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/common_decoder.cc
diff --git a/gpu/command_buffer/service/common_decoder.cc b/gpu/command_buffer/service/common_decoder.cc
index 86a37ba77e5fb8dd94c4c285ed0ce3351c46ac92..9c329927286e8995b40da0b4fb5c3c8a5bd27084 100644
--- a/gpu/command_buffer/service/common_decoder.cc
+++ b/gpu/command_buffer/service/common_decoder.cc
@@ -18,12 +18,17 @@ void* CommonDecoder::Bucket::GetData(size_t offset, size_t size) const {
return NULL;
}
-void CommonDecoder::Bucket::SetSize(size_t size) {
+bool CommonDecoder::Bucket::SetSize(size_t size) {
if (size != size_) {
data_.reset(size ? new int8[size] : NULL);
+ if (!data_.get() && (size != 0)) {
+ size_ = 0;
+ return false;
+ }
size_ = size;
memset(data_.get(), 0, size);
}
+ return true;
}
bool CommonDecoder::Bucket::SetData(
@@ -186,7 +191,9 @@ error::Error CommonDecoder::HandleSetBucketSize(
uint32 size = args.size;
Bucket* bucket = CreateBucket(bucket_id);
- bucket->SetSize(size);
+ if (!bucket->SetSize(size)) {
+ return error::kOutOfBounds;
+ }
return error::kNoError;
}
« no previous file with comments | « gpu/command_buffer/service/common_decoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698