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

Side by Side Diff: cc/ipc/render_pass_struct_traits.cc

Issue 2170603002: cc: Fix negative integer overflow in RenderPass serialization code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test. Created 4 years, 5 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 | cc/ipc/struct_traits_unittest.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "cc/ipc/render_pass_struct_traits.h" 5 #include "cc/ipc/render_pass_struct_traits.h"
6 6
7 #include "base/numerics/safe_conversions.h" 7 #include "base/numerics/safe_conversions.h"
8 #include "cc/ipc/shared_quad_state_struct_traits.h" 8 #include "cc/ipc/shared_quad_state_struct_traits.h"
9 9
10 namespace mojo { 10 namespace mojo {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 for (auto it = (*out)->quad_list.begin(); it != (*out)->quad_list.end(); 64 for (auto it = (*out)->quad_list.begin(); it != (*out)->quad_list.end();
65 ++it) { 65 ++it) {
66 if (sqs_iter.index() != shared_quad_state_references[it.index()]) 66 if (sqs_iter.index() != shared_quad_state_references[it.index()])
67 ++sqs_iter; 67 ++sqs_iter;
68 if (shared_quad_state_references[it.index()] != sqs_iter.index()) 68 if (shared_quad_state_references[it.index()] != sqs_iter.index())
69 return false; 69 return false;
70 (*it)->shared_quad_state = *sqs_iter; 70 (*it)->shared_quad_state = *sqs_iter;
71 if (!(*it)->shared_quad_state) 71 if (!(*it)->shared_quad_state)
72 return false; 72 return false;
73 } 73 }
74 return sqs_iter.index() == (*out)->shared_quad_state_list.size() - 1; 74 return (*out)->shared_quad_state_list.empty() ||
75 sqs_iter.index() == (*out)->shared_quad_state_list.size() - 1;
75 } 76 }
76 77
77 } // namespace mojo 78 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | cc/ipc/struct_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698