Mercurial > hg > truffle
diff src/share/vm/memory/allocation.cpp @ 2307:4a9604cd7c5f
6878713: Verifier heap corruption, relating to backward jsrs
Summary: Added overflow detection in arena Amalloc methods
Reviewed-by: coleenp, phh
author | kamg |
---|---|
date | Wed, 02 Mar 2011 08:18:35 -0500 |
parents | f7de3327c683 |
children | 2a3da7eaf4a6 |
line wrap: on
line diff
--- a/src/share/vm/memory/allocation.cpp Wed Mar 02 09:41:26 2011 +0100 +++ b/src/share/vm/memory/allocation.cpp Wed Mar 02 08:18:35 2011 -0500 @@ -422,6 +422,9 @@ return sum; // Return total consumed space. } +void Arena::signal_out_of_memory(size_t sz, const char* whence) const { + vm_exit_out_of_memory(sz, whence); +} // Grow a new Chunk void* Arena::grow( size_t x ) { @@ -431,8 +434,9 @@ Chunk *k = _chunk; // Get filled-up chunk address _chunk = new (len) Chunk(len); - if (_chunk == NULL) - vm_exit_out_of_memory(len * Chunk::aligned_overhead_size(), "Arena::grow"); + if (_chunk == NULL) { + signal_out_of_memory(len * Chunk::aligned_overhead_size(), "Arena::grow"); + } if (k) k->set_next(_chunk); // Append new chunk to end of linked list else _first = _chunk; @@ -529,6 +533,7 @@ // for debugging with UseMallocOnly void* Arena::internal_malloc_4(size_t x) { assert( (x&(sizeof(char*)-1)) == 0, "misaligned size" ); + check_for_overflow(x, "Arena::internal_malloc_4"); if (_hwm + x > _max) { return grow(x); } else {