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; |
} |