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

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 2528243002: Fix silent truncations when extracting values from CheckedNumeric (Closed)
Patch Set: compile fix Created 4 years 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 unified diff | Download patch
« no previous file with comments | « device/hid/hid_connection_mac.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A class to emulate GLES2 over command buffers. 5 // A class to emulate GLES2 over command buffers.
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 6309 matching lines...) Expand 10 before | Expand all | Expand 10 after
6320 // TODO(zmo): Implement client side caching. 6320 // TODO(zmo): Implement client side caching.
6321 return false; 6321 return false;
6322 } 6322 }
6323 6323
6324 bool GLES2Implementation::PackStringsToBucket(GLsizei count, 6324 bool GLES2Implementation::PackStringsToBucket(GLsizei count,
6325 const char* const* str, 6325 const char* const* str,
6326 const GLint* length, 6326 const GLint* length,
6327 const char* func_name) { 6327 const char* func_name) {
6328 DCHECK_LE(0, count); 6328 DCHECK_LE(0, count);
6329 // Compute the total size. 6329 // Compute the total size.
6330 base::CheckedNumeric<size_t> total_size = count; 6330 base::CheckedNumeric<uint32_t> total_size = count;
6331 total_size += 1; 6331 total_size += 1;
6332 total_size *= sizeof(GLint); 6332 total_size *= sizeof(GLint);
6333 if (!total_size.IsValid()) { 6333 if (!total_size.IsValid()) {
6334 SetGLError(GL_INVALID_VALUE, func_name, "overflow"); 6334 SetGLError(GL_INVALID_VALUE, func_name, "overflow");
6335 return false; 6335 return false;
6336 } 6336 }
6337 size_t header_size = total_size.ValueOrDefault(0); 6337 size_t header_size = total_size.ValueOrDefault(0);
6338 std::vector<GLint> header(count + 1); 6338 std::vector<GLint> header(count + 1);
6339 header[0] = static_cast<GLint>(count); 6339 header[0] = static_cast<GLint>(count);
6340 for (GLsizei ii = 0; ii < count; ++ii) { 6340 for (GLsizei ii = 0; ii < count; ++ii) {
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
7030 cached_extensions_.clear(); 7030 cached_extensions_.clear();
7031 } 7031 }
7032 7032
7033 // Include the auto-generated part of this file. We split this because it means 7033 // Include the auto-generated part of this file. We split this because it means
7034 // we can easily edit the non-auto generated parts right here in this file 7034 // we can easily edit the non-auto generated parts right here in this file
7035 // instead of having to edit some template or the code generator. 7035 // instead of having to edit some template or the code generator.
7036 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 7036 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
7037 7037
7038 } // namespace gles2 7038 } // namespace gles2
7039 } // namespace gpu 7039 } // namespace gpu
OLDNEW
« no previous file with comments | « device/hid/hid_connection_mac.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698