Index: src/s390/assembler-s390.cc |
diff --git a/src/s390/assembler-s390.cc b/src/s390/assembler-s390.cc |
index d5d0ebe106131a5b312ddbbf860503e93ba4cfc4..407eddac9bafc8d2e6fae7d174368166fd01b135 100644 |
--- a/src/s390/assembler-s390.cc |
+++ b/src/s390/assembler-s390.cc |
@@ -2059,7 +2059,14 @@ void Assembler::GrowBuffer(int needed) { |
if (space < needed) { |
desc.buffer_size += needed - space; |
} |
- 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"); |
+ } |
// Set up new buffer. |
desc.buffer = NewArray<byte>(desc.buffer_size); |