Index: syzygy/agent/asan/block.cc |
diff --git a/syzygy/agent/asan/block.cc b/syzygy/agent/asan/block.cc |
index 3399d02c7a21483f652386775b76d9472b03bf4d..2e639e731ff165588291e6ccf572522b53cef35e 100644 |
--- a/syzygy/agent/asan/block.cc |
+++ b/syzygy/agent/asan/block.cc |
@@ -239,6 +239,11 @@ bool BlockPlanLayout(uint32_t chunk_size, |
DCHECK_GE(chunk_size, alignment); |
DCHECK(::common::IsPowerOfTwo(alignment)); |
+ // Prevent from trying to allocate a memory block bigger than what we can |
+ // represent in the block header. |
+ if (size > kBlockMaxAllocSize) |
+ return false; |
+ |
// Calculate minimum redzone sizes that respect the parameters. |
uint32_t left_redzone_size = static_cast<uint32_t>(::common::AlignUp( |
std::max<uint32_t>(min_left_redzone_size, sizeof(BlockHeader)), |