[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - comphelper/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 16 15:25:46 UTC 2020


 comphelper/source/misc/hash.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 4c7cf4409c12d503c4151cb4536a5ccbe7ef43e4
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Mar 26 09:43:59 2020 +0100
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Dec 16 16:25:12 2020 +0100

    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 at redhat.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107838
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

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


More information about the Libreoffice-commits mailing list