oox/source/ole/vbaexport.cxx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
New commits: commit 0e439c7289a3a0679929a9baf7ee41c8f31e6d96 Author: Caolán McNamara <[email protected]> AuthorDate: Fri Jan 16 11:39:28 2026 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Jan 16 18:30:14 2026 +0100 reuse comphelper::rng::uniform_uint_distribution see also: commit 6d9228d6b14d968fa92df3ca018a555f8652e579 Date: Fri May 3 14:17:27 2024 +0100 lok: reseed comphelper's random number generator on fork. Also avoid std::random_device it doesn't work in a COOL kit process. Change-Id: I0ea3607a689632bf75861d367db70ac6c7f40a90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197443 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx index 049c8fc1e9a9..7131c8755d13 100644 --- a/oox/source/ole/vbaexport.cxx +++ b/oox/source/ole/vbaexport.cxx @@ -10,7 +10,6 @@ #include <sal/config.h> #include <cassert> -#include <random> #include <string_view> #include <oox/ole/vbaexport.hxx> @@ -30,6 +29,7 @@ #include <sot/storage.hxx> +#include <comphelper/random.hxx> #include <comphelper/xmltools.hxx> #include <utility> #include <rtl/tencinfo.h> @@ -376,14 +376,10 @@ VBAEncryption::VBAEncryption(const sal_uInt8* pData, const sal_uInt16 length, ,mnEncryptedByte2(0) ,mnProjKey(nProjKey) ,mnIgnoredLength(0) - ,mnSeed(0x00) + ,mnSeed(comphelper::rng::uniform_uint_distribution(0, 255)) ,mnVersionEnc(0) ,meTextEncoding(eTextEncoding) { - std::random_device rd; - std::mt19937 gen(rd()); - std::uniform_int_distribution<> dis(0, 255); - mnSeed = dis(gen); } void VBAEncryption::writeSeed()
