mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8286519: Better memory handling
Reviewed-by: coleenp, rhalade
This commit is contained in:
parent
48cc9a8717
commit
c622d56a0d
1 changed files with 5 additions and 0 deletions
|
@ -655,6 +655,11 @@ void* os::malloc(size_t size, MEMFLAGS memflags, const NativeCallStack& stack) {
|
|||
|
||||
const size_t outer_size = size + MemTracker::overhead_per_malloc();
|
||||
|
||||
// Check for overflow.
|
||||
if (outer_size < size) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ALLOW_C_FUNCTION(::malloc, void* const outer_ptr = ::malloc(outer_size);)
|
||||
if (outer_ptr == NULL) {
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue