oox/source/ole/vbaexport.cxx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
New commits: commit 568ae27a88319e82bf540db17cf8bf7c4a80a5be Author: Caolán McNamara <[email protected]> AuthorDate: Fri Jan 16 11:39:28 2026 +0000 Commit: Ashod Nakashian <[email protected]> CommitDate: Thu Jan 22 23:41:05 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/+/197444 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Ashod Nakashian <[email protected]> (cherry picked from commit 451134ddd32b3ebbde5bab94b6ede48fd373b8ba) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197645 Tested-by: Ashod Nakashian <[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()
