[Libreoffice-commits] .: sal/rtl

Caolán McNamara caolan at kemper.freedesktop.org
Tue Dec 13 06:54:54 PST 2011


 sal/rtl/source/alloc_global.cxx |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit edf90c212d8bfe6360a1e35eb4d7fbbf82ed33b4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Dec 13 14:53:41 2011 +0000

    warn about massive allocs

diff --git a/sal/rtl/source/alloc_global.cxx b/sal/rtl/source/alloc_global.cxx
index 6cf7509..59213a1 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 <sal/log.hxx>
 #include <sal/macros.h>
 
 #include <cassert>
@@ -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)
     {


More information about the Libreoffice-commits mailing list