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

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

Issue 6034008: Sandbox: Fix the memory protection code to handle page boundaries.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 | 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) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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/sandbox_nt_util.h" 5 #include "sandbox/src/sandbox_nt_util.h"
6 6
7 #include "base/win/pe_image.h" 7 #include "base/win/pe_image.h"
8 #include "sandbox/src/sandbox_factory.h" 8 #include "sandbox/src/sandbox_factory.h"
9 #include "sandbox/src/target_services.h" 9 #include "sandbox/src/target_services.h"
10 10
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 466
467 NTSTATUS AutoProtectMemory::ChangeProtection(void* address, size_t bytes, 467 NTSTATUS AutoProtectMemory::ChangeProtection(void* address, size_t bytes,
468 ULONG protect) { 468 ULONG protect) {
469 DCHECK_NT(!changed_); 469 DCHECK_NT(!changed_);
470 SIZE_T new_bytes = bytes; 470 SIZE_T new_bytes = bytes;
471 NTSTATUS ret = g_nt.ProtectVirtualMemory(NtCurrentProcess, &address, 471 NTSTATUS ret = g_nt.ProtectVirtualMemory(NtCurrentProcess, &address,
472 &new_bytes, protect, &old_protect_); 472 &new_bytes, protect, &old_protect_);
473 if (NT_SUCCESS(ret)) { 473 if (NT_SUCCESS(ret)) {
474 changed_ = true; 474 changed_ = true;
475 address_ = address; 475 address_ = address;
476 bytes_ = bytes; 476 bytes_ = new_bytes;
477 } 477 }
478 478
479 return ret; 479 return ret;
480 } 480 }
481 481
482 NTSTATUS AutoProtectMemory::RevertProtection() { 482 NTSTATUS AutoProtectMemory::RevertProtection() {
483 if (!changed_) 483 if (!changed_)
484 return STATUS_SUCCESS; 484 return STATUS_SUCCESS;
485 485
486 DCHECK_NT(address_); 486 DCHECK_NT(address_);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 UNREFERENCED_PARAMETER(type); 577 UNREFERENCED_PARAMETER(type);
578 return buffer; 578 return buffer;
579 } 579 }
580 580
581 void __cdecl operator delete(void* memory, void* buffer, 581 void __cdecl operator delete(void* memory, void* buffer,
582 sandbox::AllocationType type) { 582 sandbox::AllocationType type) {
583 UNREFERENCED_PARAMETER(memory); 583 UNREFERENCED_PARAMETER(memory);
584 UNREFERENCED_PARAMETER(buffer); 584 UNREFERENCED_PARAMETER(buffer);
585 UNREFERENCED_PARAMETER(type); 585 UNREFERENCED_PARAMETER(type);
586 } 586 }
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