From edf90c212d8bfe6360a1e35eb4d7fbbf82ed33b4 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 13 Dec 2011 14:53:41 +0000 Subject: warn about massive allocs --- sal/rtl/source/alloc_global.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sal/rtl') diff --git a/sal/rtl/source/alloc_global.cxx b/sal/rtl/source/alloc_global.cxx index 6cf7509a9058..59213a11a8ea 100644 --- a/sal/rtl/source/alloc_global.cxx +++ b/sal/rtl/source/alloc_global.cxx @@ -28,6 +28,7 @@ #include "alloc_impl.hxx" #include "rtl/alloc.h" +#include #include #include @@ -295,6 +296,9 @@ void * SAL_CALL rtl_reallocateMemory_SYSTEM (void * p, sal_Size n) void* SAL_CALL rtl_allocateMemory (sal_Size n) SAL_THROW_EXTERN_C() { + SAL_WARN_IF( + n >= SAL_MAX_INT32, "sal", + "suspicious massive alloc " << n); #if !defined(FORCE_SYSALLOC) while (1) { @@ -315,6 +319,9 @@ void* SAL_CALL rtl_allocateMemory (sal_Size n) SAL_THROW_EXTERN_C() void* SAL_CALL rtl_reallocateMemory (void * p, sal_Size n) SAL_THROW_EXTERN_C() { + SAL_WARN_IF( + n >= SAL_MAX_INT32, "sal", + "suspicious massive alloc " << n); #if !defined(FORCE_SYSALLOC) while (1) { -- cgit