OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MOJO_SYSTEM_MEMORY_H_ |
| 6 #define MOJO_SYSTEM_MEMORY_H_ |
| 7 |
| 8 #include <stddef.h> |
| 9 |
| 10 namespace mojo { |
| 11 namespace system { |
| 12 |
| 13 // Verify that |count * size_each| bytes can be read from the user |pointer| |
| 14 // insofar as possible/necessary. |count| and |size_each| are specified |
| 15 // separately instead of a single size, since |count * size_each| may overflow a |
| 16 // |size_t|. |count| may be zero but |size_each| must be nonzero. |
| 17 // |
| 18 // For example, if running in kernel mode, this should be a full verification |
| 19 // that the given memory is owned and readable by the user process. In user |
| 20 // mode, if crashes are acceptable, this may do nothing at all (and always |
| 21 // return true). |
| 22 bool VerifyUserPointer(const void* pointer, size_t count, size_t size_each); |
| 23 |
| 24 } // namespace system |
| 25 } // namespace mojo |
| 26 |
| 27 #endif // MOJO_SYSTEM_MEMORY_H_ |
OLD | NEW |