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

Unified Diff: core/cross/buffer.cc

Issue 194059: Check for value overlow in buffer.cc (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 11 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/cross/buffer.cc
===================================================================
--- core/cross/buffer.cc (revision 25781)
+++ core/cross/buffer.cc (working copy)
@@ -159,6 +159,13 @@
}
size_t size_in_bytes = num_elements * stride_;
+ // Check for size_t overflow.
+ if (size_in_bytes / stride_ != num_elements) {
+ O3D_ERROR(service_locator())
+ << "Attempt to allocate too many elements for the current set of "
+ << "fields on buffer.";
+ return false;
+ }
if (size_in_bytes == 0) {
O3D_ERROR(service_locator())
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698