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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 822953002: Validate Bucket data in ShaderSourceBucket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 12 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 7072 matching lines...) Expand 10 before | Expand all | Expand 10 after
7083 7083
7084 error::Error GLES2DecoderImpl::HandleShaderSourceBucket( 7084 error::Error GLES2DecoderImpl::HandleShaderSourceBucket(
7085 uint32 immediate_data_size, 7085 uint32 immediate_data_size,
7086 const void* cmd_data) { 7086 const void* cmd_data) {
7087 const gles2::cmds::ShaderSourceBucket& c = 7087 const gles2::cmds::ShaderSourceBucket& c =
7088 *static_cast<const gles2::cmds::ShaderSourceBucket*>(cmd_data); 7088 *static_cast<const gles2::cmds::ShaderSourceBucket*>(cmd_data);
7089 Bucket* bucket = GetBucket(c.data_bucket_id); 7089 Bucket* bucket = GetBucket(c.data_bucket_id);
7090 if (!bucket || bucket->size() == 0) { 7090 if (!bucket || bucket->size() == 0) {
7091 return error::kInvalidArguments; 7091 return error::kInvalidArguments;
7092 } 7092 }
7093
7094 if (!bucket->GetData(0, bucket->size() - 1)) {
Zhenyao Mo 2014/12/31 00:13:47 Good catch. But instead of checking it here, it m
sivag 2014/12/31 11:22:19 Done.
7095 return error::kOutOfBounds;
7096 }
7097
7093 return ShaderSourceHelper( 7098 return ShaderSourceHelper(
7094 c.shader, bucket->GetDataAs<const char*>(0, bucket->size() - 1), 7099 c.shader, bucket->GetDataAs<const char*>(0, bucket->size() - 1),
7095 bucket->size() - 1); 7100 bucket->size() - 1);
7096 } 7101 }
7097 7102
7098 void GLES2DecoderImpl::DoCompileShader(GLuint client_id) { 7103 void GLES2DecoderImpl::DoCompileShader(GLuint client_id) {
7099 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompileShader"); 7104 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompileShader");
7100 Shader* shader = GetShaderInfoNotProgram(client_id, "glCompileShader"); 7105 Shader* shader = GetShaderInfoNotProgram(client_id, "glCompileShader");
7101 if (!shader) { 7106 if (!shader) {
7102 return; 7107 return;
(...skipping 4459 matching lines...) Expand 10 before | Expand all | Expand 10 after
11562 } 11567 }
11563 } 11568 }
11564 11569
11565 // Include the auto-generated part of this file. We split this because it means 11570 // Include the auto-generated part of this file. We split this because it means
11566 // we can easily edit the non-auto generated parts right here in this file 11571 // we can easily edit the non-auto generated parts right here in this file
11567 // instead of having to edit some template or the code generator. 11572 // instead of having to edit some template or the code generator.
11568 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 11573 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
11569 11574
11570 } // namespace gles2 11575 } // namespace gles2
11571 } // namespace gpu 11576 } // namespace gpu
OLDNEW
« 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