summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-03-26 09:43:59 +0100
committerTor Lillqvist <tml@collabora.com>2020-12-16 16:25:12 +0100
commit4c7cf4409c12d503c4151cb4536a5ccbe7ef43e4 (patch)
tree6190a3eeddedb2d8d214d39158b2719c27b414ce /comphelper
parentc3c2979b9939d51e8ef4eb304cdfd01ca236bc9a (diff)
Check call to NSS_NoDB_Init for success
I had run into this when prior to 23245f723fb29262b8543d6447d1b0bb69cb50fb "external/nss: Fix rpath for Linux et al" that call had failed at least for my Linux ASan+UBSan build, causing UITest_calc_tests to fail with > ../../lib/cryptohi/sechash.c:443:16: runtime error: member access within null pointer of type 'HASHContext' (aka 'struct HASHContextStr') > #0 in HASH_Begin at workdir/UnpackedTarball/nss/nss/out/Debug/../../lib/cryptohi/sechash.c:443:16 (instdir/program/libnss3.so +0x3c47eb) > #1 in comphelper::HashImpl::HashImpl(comphelper::HashType) at comphelper/source/misc/hash.cxx:78:9 (instdir/program/libcomphelper.so +0x149945a) > #2 in comphelper::Hash::Hash(comphelper::HashType) at comphelper/source/misc/hash.cxx:96:16 (instdir/program/libcomphelper.so +0x1496eb7) > #3 in vcl::PDFWriterImpl::PDFWriterImpl(vcl::PDFWriter::PDFWriterContext const&, com::sun::star::uno::Reference<com::sun::star::beans::XMaterialHolder> const&, vcl::PDFWriter&) at vcl/source/gdi/pdfwriter_impl.cxx:1137:9 (instdir/program/libvcllo.so +0x8f20d3c) because that HASH functionality was used even though initializing it had failed. Throwing a RuntimeException appears to be effective, even though conceptually not the best approach: at least doing "Export Directly as PDF" of a fresh Writer document fails cleanly with an error box "Error saving the document Untitled 1: General Error. General input/output error." Change-Id: I07564a7f27a7b44e535556032e0eeb267026f06d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91088 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107838 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/hash.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/comphelper/source/misc/hash.cxx b/comphelper/source/misc/hash.cxx
index 3db0b3e56616..119044985bc5 100644
--- a/comphelper/source/misc/hash.cxx
+++ b/comphelper/source/misc/hash.cxx
@@ -7,6 +7,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <sal/config.h>
+
+#include <com/sun/star/uno/Reference.hxx>
#include <comphelper/hash.hxx>
#include <rtl/ustring.hxx>
#include <rtl/alloc.h>
@@ -73,7 +76,10 @@ struct HashImpl
{
#if USE_TLS_NSS
- NSS_NoDB_Init(nullptr);
+ auto const e = NSS_NoDB_Init(nullptr);
+ if (e != SECSuccess) {
+ throw css::uno::RuntimeException("NSS_NoDB_Init failed with " + OUString::number(e));
+ }
mpContext = HASH_Create(getNSSType());
HASH_Begin(mpContext);
#elif USE_TLS_OPENSSL