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

Side by Side Diff: util/posix/process_info_mac.cc

Issue 813473002: DCHECK_LE for cr_ngroups vs arraysize(cr_groups) (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 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 | « 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 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 gid_t ProcessInfo::SavedGroupID() const { 103 gid_t ProcessInfo::SavedGroupID() const {
104 INITIALIZATION_STATE_DCHECK_VALID(initialized_); 104 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
105 return kern_proc_info_.kp_eproc.e_pcred.p_svgid; 105 return kern_proc_info_.kp_eproc.e_pcred.p_svgid;
106 } 106 }
107 107
108 std::set<gid_t> ProcessInfo::SupplementaryGroups() const { 108 std::set<gid_t> ProcessInfo::SupplementaryGroups() const {
109 INITIALIZATION_STATE_DCHECK_VALID(initialized_); 109 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
110 110
111 const short ngroups = kern_proc_info_.kp_eproc.e_ucred.cr_ngroups; 111 const short ngroups = kern_proc_info_.kp_eproc.e_ucred.cr_ngroups;
112 DCHECK_GE(ngroups, 0); 112 DCHECK_GE(ngroups, 0);
113 DCHECK_LT(static_cast<size_t>(ngroups), 113 DCHECK_LE(static_cast<size_t>(ngroups),
114 arraysize(kern_proc_info_.kp_eproc.e_ucred.cr_groups)); 114 arraysize(kern_proc_info_.kp_eproc.e_ucred.cr_groups));
115 115
116 const gid_t* groups = kern_proc_info_.kp_eproc.e_ucred.cr_groups; 116 const gid_t* groups = kern_proc_info_.kp_eproc.e_ucred.cr_groups;
117 return std::set<gid_t>(&groups[0], &groups[ngroups]); 117 return std::set<gid_t>(&groups[0], &groups[ngroups]);
118 } 118 }
119 119
120 std::set<gid_t> ProcessInfo::AllGroups() const { 120 std::set<gid_t> ProcessInfo::AllGroups() const {
121 INITIALIZATION_STATE_DCHECK_VALID(initialized_); 121 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
122 122
123 std::set<gid_t> all_groups = SupplementaryGroups(); 123 std::set<gid_t> all_groups = SupplementaryGroups();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // Not every argument was recovered. 224 // Not every argument was recovered.
225 LOG(ERROR) << "did not recover all arguments"; 225 LOG(ERROR) << "did not recover all arguments";
226 return false; 226 return false;
227 } 227 }
228 228
229 argv->swap(local_argv); 229 argv->swap(local_argv);
230 return true; 230 return true;
231 } 231 }
232 232
233 } // namespace crashpad 233 } // namespace crashpad
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