summaryrefslogtreecommitdiff
path: root/sal
AgeCommit message (Collapse)Author
2024-06-19use gb_StaticLibrary_WORKDIR and gb_Library_DLLDIR more consistentlyChristian Lohmaier
same for gb_Executable_BINDIR[_FOR_BUILD] and fold gb_Library_WORKDIR_FOR_BUILD into gb_Library_DLLDIR_FOR_BUILD (the latter also has a workdir variant) Change-Id: If7e4cf9aab46728182c89344546065bc33b452b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169201 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2024-05-29Properly fix use of uninitialized valueStephan Bergmann
Following up on 66322c5f4a5465c74fa3ceefaa2f76e86a277c16 "Silence warning C4701: potentially uninitialized local variable" (which had apparently wrongly assumed that that MSVC warning was a false positive) and b1a6bd87b803f760f5bf0e2b7bc519b3b2fbfa4e "ofz: Use-of-uninitialized-value in ImplConvertUtf8ToUnicode", which had demonstrated that this was indeed a true positive, as per the comment at <https://gerrit.libreoffice.org/c/core/+/168079/2#message-8b941c986658cb41641c0a317937bd0d3574e0b9> "ofz: Use-of-uninitialized-value in ImplConvertUtf8ToUnicode", and which could also be observed with a local patch of > diff --git a/sal/textenc/tcvtutf8.cxx b/sal/textenc/tcvtutf8.cxx > index 05290cc204fd..319acd41c627 100644 > --- a/sal/textenc/tcvtutf8.cxx > +++ b/sal/textenc/tcvtutf8.cxx > @@ -56,7 +56,7 @@ void ImplResetUtf8ToUnicodeContext(void * pContext) > { > if (pContext != nullptr) > { > - static_cast< ImplUtf8ToUnicodeContext * >(pContext)->nBytes = int(); > + static_cast< ImplUtf8ToUnicodeContext * >(pContext)->nBytes = 1234; > static_cast< ImplUtf8ToUnicodeContext * >(pContext)->nShift = -1; > static_cast< ImplUtf8ToUnicodeContext * >(pContext)->bCheckBom = true; > } > @@ -74,7 +74,7 @@ sal_Size ImplConvertUtf8ToUnicode( > { > bool bJavaUtf8 = pData != nullptr; > sal_uInt32 nUtf32 = 0; > - int nBytes = int(); > + int nBytes = 1234; > int nShift = -1; > bool bCheckBom = true; > sal_uInt32 nInfo = 0; > @@ -208,6 +208,7 @@ sal_Size ImplConvertUtf8ToUnicode( > continue; > > bad_input: > + assert(nBytes != 1234); > switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( > false, nBytes != 1, 0, nFlags, &pDestBufPtr, pDestBufEnd, > &nInfo)) and seeing CppunitTest_sal_rtl CPPUNIT_TEST_NAME=Test::testInvalidUtf8 fail by hitting that assert. So initialize nBytes to 1 to make that bad_input scenario call handleBadInputTextToUnicodeConversion with a bMultiByte=false argument. Change-Id: Ib8a326d497071f4249169e9d4f5871f06cfccbdf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168181 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-05-27ofz: Use-of-uninitialized-value in ImplConvertUtf8ToUnicodeCaolán McNamara
probably since: commit 08e78607ec6bc820c52ab3df1a5d3738e049b90d Date: Wed Sep 13 08:28:32 2017 +0200 Make reading UTF-8 strict Change-Id: I4754e8c1314d37c7a863db4a1d9823d53fb343f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168079 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
2024-05-15Unit test for tdf#160985Eike Rathke
Change-Id: I721d127b145b6524a946c42eb23f8004c700db11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167648 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2024-05-15Resolves: tdf#160985 Max integer representation for rtl_math_StringFormat_GEike Rathke
Same as for rtl_math_StringFormat_Automatic we want to preserve the highest accuracy of integer values also with rtl_math_StringFormat_G if nDecPlaces is large enough, instead of possibly rounding into 15 digits. This occurred with FastSaxSerializer::write(double) but rtl::OString::number(double) and rtl::OUString::number(double) and rtl_math_doubleToString() and rtl::str::valueOfFP() and rtl_str_valueOfDouble() and all places calling with rtl_math_StringFormat_G are similar affected. Question might remain why those places use rtl_math_StringFormat_G with fixed nDecimalPlaces calculated from RTL_STR_MAX_VALUEOFDOUBLE - SAL_N_ELEMENTS("-x.E-xxx") + 1 instead of rtl_math_StringFormat_Automatic with rtl_math_DecimalPlaces_Max. Change-Id: Ib388b119faed441c9020dca803649a4089da5b07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167647 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2024-05-08drop requirement for rtl_random_getBytes to have "Pool" argCaolán McNamara
Seeing as since: commit e9531b792ddf0cfc2db11713b574c5fc7ae09e2c Date: Tue Feb 6 14:39:47 2024 +0100 sal: rtlRandomPool: require OS random device, abort if not present Both rtl_random_createPool() and rtl_random_getBytes() first try to get random data from the OS, via /dev/urandom or rand_s() (documented to call RtlGenRandom(), see [1]). we don't use the initial arg to rtl_random_getBytes anymore, drop the requirement to have one. Then simplify our usages of that, and addtionally deprecate rtl_random_createPool and rtl_random_destroyPool. Change-Id: I13dcc067714a8a741a4e8f2bfcf2006373f832c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167067 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-04-30we dereference pProfile->m_Lines on the next line anywayCaolán McNamara
Change-Id: I8ab203baa6276cb950e5a6168af32cb4a9fa24d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166915 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
2024-04-30WaE: C6011 Dereferencing NULL pointer warnings from unchecked mallocCaolán McNamara
upgrade OSL_ASSERT to assert and add a few more Change-Id: Ib52ca573d9e0878fef94dec40410f71bc94dea04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166914 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-04-30convert HeapAlloc to make_uniqueNoel Grandin
which means we don't have to explicitly handle OOM, and the resulting code is much cleaner Change-Id: I958d6678bb2d6878dda9de6bf82c5314f168db17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166855 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-04-29WaE: C6054: String 'baseDrive' might not be zero-terminatedCaolán McNamara
Change-Id: I0d3192dbac5ca73cd93051bcdf812bbe34a77c8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166828 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-04-28Extended loplugin:ostr manual changesStephan Bergmann
I had done these a while ago, when I looked into extending loplugin:ostr to do more automatic rewriting, and these were places where I needed to do something manually, for one reason or another, because the automatic rewriting would not pick it up correctly. However, I got distracted, and a wholesale automatic rewrite would still run into cases where an _ostr/_ustr instance from a library's .rodata would still be referenced after the library has already been dlcose'd. So I never came around to finishing all that. But there appears to be renewed interest in (automatic) rewritings here now, so it probably makes sense if I share this part of my work anyway. Change-Id: I3da9d38398e4bca373cb0000a9d34b49a36ad58a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166792 Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Tested-by: Jenkins
2024-04-26loplugin:ostr in salNoel Grandin
Change-Id: I7732a77fc5ac8d1f5c53052e0f4b6c7e7d70f054 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166739 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
2024-04-15lok: provide global random symbol to find random device.Michael Meeks
This is vital for lok when used in a jail with no random device, but with an inherited file-handle to /dev/urandom. Use 'dup' to avoid changing code that wants to 'close' the handle after use. Change-Id: I15f40fb251f180a2394af030f56e47f2bf9651d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166113 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-04-03Allow custom "eye catcher" from LO_TESTNAME in tempfiles on WindowsMike Kaganski
Change-Id: Id8d94af9e03d0c8553d0a7949e4a9259159481cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165732 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-03-26No need to define ETIMEStephan Bergmann
(which is an obsolescent XSI-STREAMS Posix extension). It's only use is in the big switch in UnixErrnoString in sal/osl/unx/uunxapi.cxx, so if any platform should actually lack it, we should rather #ifdef its use there than introduce it here. (This started to cause > sal/osl/unx/system.hxx:190:12: error: macro 'ETIME' has been marked as deprecated: ETIME is deprecated in ISO C++ [-Werror,-Wdeprecated-pragma] > 190 | # ifndef ETIME > | ^ > ~/llvm/inst/bin/../include/c++/v1/cerrno:51:67: note: macro marked 'deprecated' here > 51 | # pragma clang deprecated(ETIME, "ETIME is deprecated in ISO C++") > | ^ with recent LLVM 19 trunk on macOS now.) Change-Id: I01a586f08a4d9e4643c797fce5ce53c5f3ce8b81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165303 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-26Silence -Wdeprecated-pragmaStephan Bergmann
...as seen with recent LLVM 19 trunk on macOS now, > In file included from sal/osl/unx/uunxapi.mm:1: > sal/osl/unx/uunxapi.cxx:612:14: error: macro 'ENOSTR' has been marked as deprecated: ENOSTR is deprecated in ISO C++ [-Werror,-Wdeprecated-pragma] > 612 | case ENOSTR: > | ^ > ~/llvm/inst/bin/../include/c++/v1/cerrno:48:69: note: macro marked 'deprecated' here > 48 | # pragma clang deprecated(ENOSTR, "ENOSTR is deprecated in ISO C++") > | ^ etc. (And -Wdeprecated-pragma was only added towards Clang 14 with <https://github.com/llvm/llvm-project/commit/26c695b7893071d5e69afbaa70c4850ab2e468be> "Support macro deprecation #pragma clang deprecated", so wrap it in __has_warning.) Change-Id: I8db1f00a48bb647573d287c3410137182570f82b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165304 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-25Best effort to create directories of SAL_LOG_FILEStephan Bergmann
Change-Id: Ia86ac0e022579d155e92de3b853d57860b5b97e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165272 Tested-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-25Avoid -Werror,-Wcast-function-type-mismatchStephan Bergmann
Change-Id: I93a69c57856169aeff613e34d5c0bf7fa08a0de7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165251 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-21Use consistent conditions in code and makefileStephan Bergmann
24b06b9c6bdb777dff385b0fbfc81d55d3d013a1 "log access violation on windows tinderboxen" introduced C++ code into sal/cppunittester/cppunittester.cxx that is conditional on "#if defined(_DEBUG)" (which is defined iff $(MSVC_USE_DEBUG_RUNTIME) is TRUE, see the setting of -D_DEBUG in solenv/gbuild/gbuild.mk), and it introduced this corresponding makefile code which should thus use the same condition. Change-Id: I62fca71e31ed9215984572dc6a2e05be41651b15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165080 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-18use our internal backtrace API for signal faultsNoel Grandin
so we get nice stacktraces with function names and line numbers on jenkins Change-Id: Id1bfee014d713ead501e5164e5206d9189ec72a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164967 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-13Support environment variable expansion in logging.iniStephan Bergmann
The syntax is a stripped-down subset of what is available for variable expansion in bootstrap ini-files: It only supports "${name}", to be replaced with the contents of an environment variable of that name (which itself is not expanded further). If no such environment variable exists, it is replaced with the empty string. If the name contains a NUL character, or if there is a syntax error (i.e., missing opening or closing curly brace), the corresponding text is left unchanged. Also, backslash quoting is supported to allow for verbatim, uninterpreted "${name}" content. But logging.ini is typically used to specify Windows-style LogFilePath=C:\log.txt pathnames containing backslashes, so restrict backslash quoting to just "\$" (replaced with "$") and "\\" (replaced with "\"), and leave all other backslashes alone. (It is not possible to reuse the bootstrap macro expansion code here, as that would cause recursive dependencies. Therefore, this only implements this stripped-down subset.) Change-Id: I8c949a1637a7f14e0672a9cc1c79014edfa336bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164759 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-08Avoid mentioning Glibc-internal type __fsword_tStephan Bergmann
...and clean up the use of macros here Change-Id: Iede9ff705992d5e229b44b48cd88f5b495f6cee4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164571 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-08Blind fix for Linux 32-bit buildsStephan Bergmann
...which, according to <https://lists.freedesktop.org/archives/libreoffice/2024-March/091666.html> "32 bit build failure (smb, narrowing)", started to fail with > /<<PKGBUILDDIR>>/sal/osl/unx/file.cxx: In function ‘void osl_file_adjustLockFlags(const rtl::OString&, int*, sal_uInt32*)’: > /<<PKGBUILDDIR>>/sal/osl/unx/file.cxx:71:26: error: narrowing conversion of ‘4283649346’ from ‘unsigned int’ to ‘int’ [-Wnarrowing] > 71 | #define CIFS_SUPER_MAGIC 0xFF534D42 > | ^~~~~~~~~~ > /<<PKGBUILDDIR>>/sal/osl/unx/file.cxx:795:14: note: in expansion of macro ‘CIFS_SUPER_MAGIC’ > 795 | case CIFS_SUPER_MAGIC: > | ^~~~~~~~~~~~~~~~ etc. My Fedora 39 "Linux man-pages 6.05" statfs(2) man page explains about the struct statfs f_type field of __fsword_t type: "The __fsword_t type used for various fields in the statfs structure definition is a glibc internal type, not intended for public use. This leaves the programmer in a bit of a conundrum when trying to copy or compare these fields to local variables in a program. Using unsigned int for such variables suffices on most systems." But the underlying __FSWORD_T_TYPE looks like it is actually defined as a signed type in /usr/include/bits/typesizes.h. Change-Id: Ida3ae84031c4e48b0d6e69d76b66b4e4facfa1ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164561 Tested-by: René Engelhard <rene@debian.org> Reviewed-by: René Engelhard <rene@debian.org> Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-05Missing include (for free)Stephan Bergmann
Change-Id: I2dbf6d8894368d93bbed8c2bdf09f978196c6aa5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164427 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-29Simplify a bitMike Kaganski
Change-Id: I90e26030cb7a002bfd76cbc7aa73a5d3ea7a7f1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164132 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-29Use <bit> instead of platform-specific intrinsicsMike Kaganski
Change-Id: I79636ff9c3b2fe601b0b3c94a111b36af0011775 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164131 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-29Drop redundant code: this is handled belowMike Kaganski
And use standard functions in the rtl_math_RoundingMode_HalfEven handler. Change-Id: If9f29aa63423db9457a02ed003cfc27cf3df5585 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164104 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-27tdf#158190 Fix Calc ROUND in floating-point calculate result very close to X.5Po-Yen Huang
Location: if (nDecPlaces == 0) { switch (eMode) { case rtl_math_RoundingMode_Corrected: return std::round(fValue); Because the functions are the same as the following related codes, they are respectively: if (nDecPlaces >= 0 && (fValue >= 0x1p52 || isRepresentableInteger(fValue))) return fOrigValue; as well as: if (fValue < 0x1p52) { switch(eMode) { case rtl_math_RoundingMode_Corrected: fValue = rtl::math::approxFloor(fValue + 0.5); break; : : : Because some double-precision floating point numbers cause std::round(fValue) and rtl::math::approxFloor(fValue + 0.5) to produce different results. For example, enter 10614.4999999999876 in Calc's A1 cell (or any operation that will produce a long decimal number such as .499999999999xyz after the decimal point). We expected it to be 10614.4999999999876, but it was automatically rounded to 10614.5 (note: this result is also the result of ubiquitous handheld computers, OpenOffice.org and Excel) Then, entering =ROUND(A1,0) in B1, we will see 10614, A1 and B1 clearly don't meet expectations. (My boss or tax collector might be unhappy :-p) Although A1's 10614.4999999999876 is still faithfully recorded, the rendering of 10614.5 is confusing. Now, there are two views: 1. According to the established convention, B2 displays the expected answer 10615. or 2. True to the laws of mathematics, A1 displays 10614.4999999999876 or at least 10614.49 Although the second point of view is correct (and I completely agree with it), when opening spreadsheets generated by other software (such as OpenOffice.org or Excel), the results will be different, which people do not like to see. So when nDecPlaces == 0 is removed, use std::round(fValue) and let the existing code below it do the rounding: if (fValue < 0x1p52) { switch(eMode) { case rtl_math_RoundingMode_Corrected: fValue = rtl::math::approxFloor(fValue + 0.5); This is consistent with the first point. By the way, in nDecPlaces == 0 case rtl_math_RoundingMode_HalfEven: This piece of code can be checked to see if it is really necessary, because rtl_math_round() also has the same purpose code. If it is not needed, the entire nDecPlaces == 0 can be removed. Co-authored-by: Firefly <firefly@ossii.com.tw> Co-authored-by: Franklin Weng <franklin@goodhorse.idv.tw> Change-Id: If32cdb18c70ec0025c83ba25a99e5d135d66aec9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159193 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-26Simplify a bitMike Kaganski
Change-Id: I660631d43230d9fcc58c405be5138e7d0b7605fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163928 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-26Define a name for the extended path buffer size, instead of a literalMike Kaganski
Change-Id: If6d40c818e021b3241d6b6b33aceca07c6393511 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163926 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-26Use filesystem::path to avoid MAX_PATH limitationMike Kaganski
And use a buffer of 32767 characters, which is the approximate maximum of Windows API, as documented in https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation Change-Id: I7b5329d48c936ce0090f0c7908a9d08b56b5a734 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163918 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-20Simplify a bitMike Kaganski
Change-Id: Icc7589bdf5d2e3d061dfa3d34761316d9e9323be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163653 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-20Move some stuff from path_helper to file_dirvol, and simplifyMike Kaganski
Change-Id: Ic9dcff74c16e5f9c107ca060a3d22866f552c398 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163632 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-19Drop obsolete commentsMike Kaganski
They seem to have never been useful, ever since commits 4e093f7f3404d09ee302b119190a968f4f109427 (INTEGRATION: CWS sal05 (1.1.2); FILE ADDED, 2004-02-03) and 0318a882ecfa17030bcccbc05d6c34e3293b0ef2 (INTEGRATION: CWS sal05 (1.1.2); FILE ADDED, 2004-02-03). Change-Id: Ia68ee2f6facd9b64a098c630c3fed0d227e92e2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163587 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-18tdf#55004 Fix backup copy creation for files on mounted samba sharesKevin Ottens
There is an unfortunate interaction between file locking and backup creation at save time. openFilePath has logic to lock a file when opening. This goes through fcntl to set a write lock on the file. Later on, when the user wants to save changes, a backup copy might be created (very likely now since this is the defaults in the settings). To create this backup, the file is opened again for reading. Unfortunately this open call fails due to the lock (even though it is a write lock). This commit changes the behavior. osl_file_adjustLockFlags now checks if the file is on a mounted samba share. If that's the case we force the osl_File_OpenFlag_NoLock flag. No issue is then exhibited at backup creation, allowing the save to proceed properly. Change-Id: Ieab252f9f68598834e13339fc5fcea440f0a4c2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162935 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-13Fix mis-merge from 8b53fa726e0d496f18228b0ca9ce2f61196f6a57Stephan Bergmann
"Introduce a fundamental.override.ini for bootstrap variables" Change-Id: I88f11e422d98100bafd6fd9a7ab5e892dcc3fb46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163292 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-12Log uses of fundamental.override.iniStephan Bergmann
Change-Id: I36fa44b063a439edf5411a89f76ec342b1388351 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162601 Tested-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> (cherry picked from commit 6d553405101090ef7a7ff5270e5ef32aa41bd9b3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163254 Tested-by: Jenkins
2024-02-12Introduce a fundamental.override.ini for bootstrap variablesStephan Bergmann
...that is looked for next to the application and, when present, overrides all the other ways of setting bootstrap variables. LibreOffice itself does not bring along such a fundamental.override.ini, but it can be convenient for an administrator to place one in the installation (which can then not be modified or overridden by end users). (For convenience, the naming of this ini-file starts to deviate from the old and rather pointless tradition of naming our ini-files *rc vs. *.ini on different platforms.) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162187 Tested-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> (cherry picked from commit f4d376e9a10a8c66f7f6ecfe6a1f4763c1927b52) Conflicts: sal/rtl/bootstrap.cxx Change-Id: I057cc67b1af1d806587c3a4dc0bc31c28e79d22b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163251 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-11tdf#155710 handle conversion failures due to non-UTF8 stringsPatrick Luby
Windows and Linux paths can be passed as parameters to this function and those paths may not always be UTF8 encoded like macOS paths. Change-Id: I83f5ab491d3c0ddd938e512fbab3213af9ea16fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163223 Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
2024-02-11osl_get_system_random_data should return boolStephan Bergmann
Change-Id: I29535d3562fe1b8d05b8df1d6c9ab83e4ead0f74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163227 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-07sal: rtlRandomPool: require OS random device, abort if not presentMichael Stahl
Both rtl_random_createPool() and rtl_random_getBytes() first try to get random data from the OS, via /dev/urandom or rand_s() (documented to call RtlGenRandom(), see [1]). In case this does not succeed, there is a fallback to a custom implementation of a PRNG of unknown design that has never been substantially changed since initial CVS import, and is presumably not what would be considered state of the art today, particularly if there's no actual entropy available to seed it. Except for a few miscellaneous usages in URE (presumably to avoid dependencies on non-URE libs), rtlRandomPool is almost always used to generate material for encryption of documents, which is demanding and probably beyond what a pure user-space PRNG implementation without entropy from the OS can provide. So remove the custom PRNG and instead abort() if reading from the OS random device fails for whatever reason. rtl_random_addBytes() becomes a no-op and is therefore deprecated. Presumably the only kind of environment where random device would be unavailable in practice is running in some sort of chroot or container that is missing the device or has incorrect permissions on it; better to fail hard than to produce encrypted documents of questionable security. [1] https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/rand-s?view=msvc-170 Change-Id: I3f020c2d11570f8351381d70188ce59bfec9f720 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163056 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-02-05sal: Re-add missing includesHeiko Becker
They were removed as unused in [1], but it turn out that's not entirely accurate, at least if LIBO_CIPHER_OPENSSL_BACKEND is defined. assert(), o3tl::..., std::numeric_limits<T> and std::memcpy are all used inside that block. [1] 2e71c439057c8d31b6af191ef38607600cb996f0 Change-Id: I2805dc4edf1d05bec5ec203772af73dd93da12bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162967 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-01-28cool#8016 open files using O_CLOEXECNoel Grandin
which is useful to speed up exec'ing/spawning subprograms, and avoids various leakage issues. Change-Id: Ie06ceb6b377e9d5cca8c017c5666564f6bed482f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162647 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins
2024-01-19Make osl_execProc_test_batch run the new process hiddenMike Kaganski
This prevents a console window flashing briefly on Windows, when runnung the test. Was this way since commit d011896d755252105c740f23f31ed43de64f7c98 (INTEGRATION: CWS sal04 (1.1.2); FILE ADDED, 2003-09-29). Change-Id: I7fb7bb067786d3ad33f9ba831e3b454c91a35e2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162296 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-18-Werror,-Wunused-variable (Emscripten)Stephan Bergmann
Change-Id: Id931281ff716ed0fd26fda1972eb6f5defde7422 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162249 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-12-24Silence new GCC 14 trunk -Werror=alloc-sizeStephan Bergmann
> sal/rtl/byteseq.cxx: In function ‘void rtl_byte_sequence_reference2One(sal_Sequence**)’: > sal/rtl/byteseq.cxx:63:20: error: allocation of insufficient size ‘8’ for type ‘sal_Sequence’ {aka ‘_sal_Sequence’} with size ‘12’ [-Werror=alloc-size] > 63 | pNew = static_cast<sal_Sequence *>(malloc( SAL_SEQUENCE_HEADER_SIZE )); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: I9d4081ed2938fffdf282c852250a3eed5f0d9e25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161269 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-12-24-Werror=calloc-transposed-argsStephan Bergmann
Change-Id: I7b8b020bdbcd5b4db4cb478cc5fe1225f19ae0cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161268 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-12-24Remove unused headers found by bin/find-unusedheaders.shGabor Kelemen
Change-Id: I859138dee575ef7fd76db28b619c673782914782 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161235 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <kelemeng@ubuntu.com>
2023-12-19Fix typoAndrea Gelmini
Change-Id: Ie9848c31ee4969d61470dfb5b570e45848f0914d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160992 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-11Step 3 of removing cargo-cult pragma pack around rtl_[u]StringStephan Bergmann
see 8ae3ae4bf75fdd0aaa132c956d9da029baa3adc6 "Step 1 of removing cargo-cult pragma pack around rtl_[u]String" Change-Id: If6c2ea0ab2e7e61cdbc880d7b27d2af7f816e66d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158568 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>