From 42d47843e9be58b2c802a78113c5a8b4437ebb2f Mon Sep 17 00:00:00 2001 From: RĂ¼diger Timm Date: Tue, 25 Nov 2003 09:45:36 +0000 Subject: 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 --- sal/rtl/source/random.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'sal/rtl/source') 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 @@ -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) -- cgit