Commit 96acdb1a authored by Chris Palmer's avatar Chris Palmer Committed by Commit Bot

Ensure that `PartitionAllocGenericFlags` callers are only using valid flags.

Bug: 680657
Change-Id: I2d879f5b28c392a083fbd867a3eb05568d19dc67
Reviewed-on: https://chromium-review.googlesource.com/1164252Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Chris Palmer <palmer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581049}
parent ddb03e9b
......@@ -344,6 +344,8 @@ ALWAYS_INLINE void* PartitionAllocGenericFlags(PartitionRootGeneric* root,
int flags,
size_t size,
const char* type_name) {
DCHECK_LT(flags, PartitionAllocLastFlag << 1);
#if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
void* result = malloc(size);
CHECK(result || flags & PartitionAllocReturnNull);
......
......@@ -154,6 +154,8 @@ static const size_t kReasonableSizeOfUnusedPages = 1024 * 1024 * 1024; // 1GB
// Flags for PartitionAllocGenericFlags.
enum PartitionAllocFlags {
PartitionAllocReturnNull = 1 << 0,
PartitionAllocLastFlag = PartitionAllocReturnNull
};
} // namespace base
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment