summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2003-11-25 09:45:36 +0000
committerRüdiger Timm <rt@openoffice.org>2003-11-25 09:45:36 +0000
commit42d47843e9be58b2c802a78113c5a8b4437ebb2f (patch)
tree0a0d03b7e7d64a5846a54ab6757c86264c11e2f1
parent65852961fc84f2cd1d97ae93722d14a39c9e57ff (diff)
INTEGRATION: CWS valgrind01 (1.2.178); FILE MERGED
2003/10/10 13:55:21 hr 1.2.178.1: #i20184#: don't feed uninitialized stack variables and buffers to the entropy pool, as this triggers memory checkers like valgrind and purify
-rw-r--r--sal/rtl/source/random.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sal/rtl/source/random.c b/sal/rtl/source/random.c
index e2dadb4cafa0..0b178690ce61 100644
--- a/sal/rtl/source/random.c
+++ b/sal/rtl/source/random.c
@@ -2,9 +2,9 @@
*
* $RCSfile: random.c,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jl $ $Date: 2001-03-14 09:50:26 $
+ * last change: $Author: rt $ $Date: 2003-11-25 10:45:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,7 @@
*
************************************************************************/
-#define _RTL_RANDOM_C_ "$Revision: 1.2 $"
+#define _RTL_RANDOM_C_ "$Revision: 1.3 $"
#ifndef _SAL_TYPES_H_
#include <sal/types.h>
@@ -182,9 +182,16 @@ static sal_Bool __rtl_random_initPool (RandomPool_Impl *pImpl)
RandomData_Impl rd;
double seed;
+ /* The use of uninitialized stack variables as a way to
+ * enhance the entropy of the random pool triggers
+ * memory checkers like purify and valgrind.
+ */
+
+ /*
__rtl_random_seedPool (pImpl, (sal_uInt8*)&id, sizeof(id));
__rtl_random_seedPool (pImpl, (sal_uInt8*)&tv, sizeof(tv));
__rtl_random_seedPool (pImpl, (sal_uInt8*)&rd, sizeof(rd));
+ */
id = osl_getThreadIdentifier (NULL);
id = RTL_RANDOM_RNG_2(RTL_RANDOM_RNG_1(id));
@@ -281,8 +288,6 @@ static void __rtl_random_readPool (
pImpl->m_hDigest,
&(pImpl->m_pDigest[RTL_RANDOM_SIZE_DIGEST/2]),
RTL_RANDOM_SIZE_DIGEST/2);
- rtl_digest_update (
- pImpl->m_hDigest, pBuffer, j);
k = (pImpl->m_nIndex + j) - pImpl->m_nData;
if (k > 0)