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

Side by Side Diff: sandbox/src/handle_closer_agent.cc

Issue 7714003: Don't crash on a NULL type-name from ObjectTypeInformation. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | Annotate | Revision Log
« 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "sandbox/src/handle_closer_agent.h" 5 #include "sandbox/src/handle_closer_agent.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "sandbox/src/nt_internals.h" 8 #include "sandbox/src/nt_internals.h"
9 #include "sandbox/src/win_utils.h" 9 #include "sandbox/src/win_utils.h"
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 while (rc == STATUS_INFO_LENGTH_MISMATCH || 85 while (rc == STATUS_INFO_LENGTH_MISMATCH ||
86 rc == STATUS_BUFFER_OVERFLOW) { 86 rc == STATUS_BUFFER_OVERFLOW) {
87 type_info_buffer.resize(size + sizeof(wchar_t)); 87 type_info_buffer.resize(size + sizeof(wchar_t));
88 type_info = reinterpret_cast<OBJECT_TYPE_INFORMATION*>( 88 type_info = reinterpret_cast<OBJECT_TYPE_INFORMATION*>(
89 &(type_info_buffer[0])); 89 &(type_info_buffer[0]));
90 rc = QueryObject(handle, ObjectTypeInformation, type_info, size, &size); 90 rc = QueryObject(handle, ObjectTypeInformation, type_info, size, &size);
91 // Leave padding for the nul terminator. 91 // Leave padding for the nul terminator.
92 if (NT_SUCCESS(0) && size == type_info_buffer.size()) 92 if (NT_SUCCESS(0) && size == type_info_buffer.size())
93 rc = STATUS_INFO_LENGTH_MISMATCH; 93 rc = STATUS_INFO_LENGTH_MISMATCH;
94 } 94 }
95 if (!NT_SUCCESS(rc)) { 95 if (!NT_SUCCESS(rc) || !type_info->Name.Buffer) {
96 ++invalid_count; 96 ++invalid_count;
97 continue; 97 continue;
98 } 98 }
99 99
100 --handle_count; 100 --handle_count;
101 type_info->Name.Buffer[type_info->Name.Length / sizeof(wchar_t)] = L'\0'; 101 type_info->Name.Buffer[type_info->Name.Length / sizeof(wchar_t)] = L'\0';
102 102
103 // Check if we're looking for this type of handle. 103 // Check if we're looking for this type of handle.
104 HandleMap::iterator result = 104 HandleMap::iterator result =
105 handles_to_close_.find(type_info->Name.Buffer); 105 handles_to_close_.find(type_info->Name.Buffer);
(...skipping 10 matching lines...) Expand all
116 return false; 116 return false;
117 if (!::CloseHandle(handle)) 117 if (!::CloseHandle(handle))
118 return false; 118 return false;
119 } 119 }
120 } 120 }
121 121
122 return true; 122 return true;
123 } 123 }
124 124
125 } // namespace sandbox 125 } // namespace sandbox
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