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

Side by Side Diff: ppapi/proxy/raw_var_data.cc

Issue 2705933002: Check that a valid RawVarData has been created before calling a function on it (Closed)
Patch Set: Created 3 years, 10 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ppapi/proxy/raw_var_data.h" 5 #include "ppapi/proxy/raw_var_data.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 std::unique_ptr<RawVarDataGraph> result(new RawVarDataGraph); 191 std::unique_ptr<RawVarDataGraph> result(new RawVarDataGraph);
192 uint32_t size = 0; 192 uint32_t size = 0;
193 if (!iter->ReadUInt32(&size)) 193 if (!iter->ReadUInt32(&size))
194 return nullptr; 194 return nullptr;
195 for (uint32_t i = 0; i < size; ++i) { 195 for (uint32_t i = 0; i < size; ++i) {
196 int32_t type; 196 int32_t type;
197 if (!iter->ReadInt(&type)) 197 if (!iter->ReadInt(&type))
198 return nullptr; 198 return nullptr;
199 PP_VarType var_type = static_cast<PP_VarType>(type); 199 PP_VarType var_type = static_cast<PP_VarType>(type);
200 result->data_.push_back(base::WrapUnique(RawVarData::Create(var_type))); 200 result->data_.push_back(base::WrapUnique(RawVarData::Create(var_type)));
201 if (!result->data_.back())
202 return nullptr;
201 if (!result->data_.back()->Read(var_type, m, iter)) 203 if (!result->data_.back()->Read(var_type, m, iter))
202 return nullptr; 204 return nullptr;
203 } 205 }
204 return result; 206 return result;
205 } 207 }
206 208
207 std::vector<SerializedHandle*> RawVarDataGraph::GetHandles() { 209 std::vector<SerializedHandle*> RawVarDataGraph::GetHandles() {
208 std::vector<SerializedHandle*> result; 210 std::vector<SerializedHandle*> result;
209 for (size_t i = 0; i < data_.size(); ++i) { 211 for (size_t i = 0; i < data_.size(); ++i) {
210 SerializedHandle* handle = data_[i]->GetHandle(); 212 SerializedHandle* handle = data_[i]->GetHandle();
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 if (!IPC::ReadParam(m, iter, creation_message_.get())) 742 if (!IPC::ReadParam(m, iter, creation_message_.get()))
741 return false; 743 return false;
742 } else { 744 } else {
743 creation_message_.reset(); 745 creation_message_.reset();
744 } 746 }
745 return true; 747 return true;
746 } 748 }
747 749
748 } // namespace proxy 750 } // namespace proxy
749 } // namespace ppapi 751 } // namespace ppapi
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