summaryrefslogtreecommitdiffstats
path: root/o3d/core
diff options
context:
space:
mode:
authorgman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-09 23:09:50 +0000
committergman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-09 23:09:50 +0000
commit49c019da6f601df69b7759717e4455912a027e08 (patch)
tree639b44d68b4c439b0db8f709dc89aacfd1c98dce /o3d/core
parent40bad03889d4fc90799fdfe39a3fd503cdfb492e (diff)
downloadchromium_src-49c019da6f601df69b7759717e4455912a027e08.zip
chromium_src-49c019da6f601df69b7759717e4455912a027e08.tar.gz
chromium_src-49c019da6f601df69b7759717e4455912a027e08.tar.bz2
missed one
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25815 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core')
-rw-r--r--o3d/core/cross/buffer.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/o3d/core/cross/buffer.cc b/o3d/core/cross/buffer.cc
index 4c0071e..d1d075a 100644
--- a/o3d/core/cross/buffer.cc
+++ b/o3d/core/cross/buffer.cc
@@ -204,6 +204,13 @@ bool Buffer::ReshuffleBuffer(unsigned int new_stride, Field* field_to_remove) {
}
if (num_elements_) {
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);
// Copy old fields into new buffer.