Commit 49c019da authored by gman@google.com's avatar gman@google.com

missed one

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25815 0039d316-1c4b-4281-b951-d872f2087c98
parent 40bad038
...@@ -204,6 +204,13 @@ bool Buffer::ReshuffleBuffer(unsigned int new_stride, Field* field_to_remove) { ...@@ -204,6 +204,13 @@ bool Buffer::ReshuffleBuffer(unsigned int new_stride, Field* field_to_remove) {
} }
if (num_elements_) { if (num_elements_) {
size_t size_in_bytes = num_elements_ * new_stride; size_t size_in_bytes = num_elements_ * new_stride;
// Check for size_t overflow.
if (size_in_bytes / new_stride != num_elements_) {
O3D_ERROR(service_locator())
<< "Attempt to allocate too many elements for the current set of "
<< "fields on buffer.";
return false;
}
std::vector<uint8> temp(size_in_bytes); std::vector<uint8> temp(size_in_bytes);
// Copy old fields into new buffer. // Copy old fields into new buffer.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment