| Index: mojo/system/memory.cc
|
| diff --git a/mojo/system/memory.cc b/mojo/system/memory.cc
|
| index df658ae5ee3d405aff88f8f244259583f22f81b3..fe7edef3da3f4a3871171a19f197c65d4e2b70c6 100644
|
| --- a/mojo/system/memory.cc
|
| +++ b/mojo/system/memory.cc
|
| @@ -11,9 +11,9 @@
|
| namespace mojo {
|
| namespace system {
|
|
|
| -bool VerifyUserPointer(const void* pointer, size_t count, size_t size_each) {
|
| - DCHECK_GT(size_each, 0u);
|
| - if (count > std::numeric_limits<size_t>::max() / size_each)
|
| +template <size_t size>
|
| +bool VerifyUserPointerForSize(const void* pointer, size_t count) {
|
| + if (count > std::numeric_limits<size_t>::max() / size)
|
| return false;
|
|
|
| // TODO(vtl): If running in kernel mode, do a full verification. For now, just
|
| @@ -22,5 +22,9 @@ bool VerifyUserPointer(const void* pointer, size_t count, size_t size_each) {
|
| return count == 0 || !!pointer;
|
| }
|
|
|
| +// Explicitly instantiate the sizes we need. Add instantiations as needed.
|
| +template bool VerifyUserPointerForSize<1>(const void*, size_t);
|
| +template bool VerifyUserPointerForSize<4>(const void*, size_t);
|
| +
|
| } // namespace system
|
| } // namespace mojo
|
|
|