Index: src/arm64/assembler-arm64.cc |
diff --git a/src/arm64/assembler-arm64.cc b/src/arm64/assembler-arm64.cc |
index ac6931dec76d3e95aa3f8ab86eb64f6faef9a857..ec12e77274a517b0dad02cab7b1618bd077e5004 100644 |
--- a/src/arm64/assembler-arm64.cc |
+++ b/src/arm64/assembler-arm64.cc |
@@ -2905,7 +2905,14 @@ void Assembler::GrowBuffer() { |
} else { |
desc.buffer_size = buffer_size_ + 1 * MB; |
} |
- CHECK_GT(desc.buffer_size, 0); // No overflow. |
+ |
+ // Some internal data structures overflow for very large buffers, |
+ // they must ensure that kMaximalBufferSize is not too large. |
+ if (desc.buffer_size > kMaximalBufferSize || |
+ static_cast<size_t>(desc.buffer_size) > |
+ isolate_data().max_old_generation_size_) { |
+ V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); |
+ } |
byte* buffer = reinterpret_cast<byte*>(buffer_); |