external/xmlsec/BCryptKeyDerivation.patch.1 |   51 ++++++++++++++++++++++++++++
 external/xmlsec/UnpackedTarball_xmlsec.mk   |    2 +
 sfx2/source/doc/sfxbasemodel.cxx            |    2 -
 3 files changed, 54 insertions(+), 1 deletion(-)

New commits:
commit 6d69bfd42eb5ecb06a0a2b4dec8819fb6d1561f2
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Wed Feb 14 10:21:20 2024 +0100
Commit:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
CommitDate: Sun Feb 25 14:30:46 2024 +0100

    tdf#159707: fix crash when changing to edit mode (calc)
    
    bt:
    0x00007f9eb4b902f2 in 
com::sun::star::uno::Reference<com::sun::star::frame::XModel>::operator->() 
const (this=0x55b8c2b54888) at include/com/sun/star/uno/Reference.h:387
    0x00007f9eb4c03584 in 
ScVbaEventsHelper::notifyEvent(com::sun::star::document::EventObject const&) 
(this=0x55b8c2b54840, rEvent=...) at 
/home/julien/lo/libreoffice/sc/source/ui/vba/vbaeventshelper.cxx:605
    0x00007f9ef464bd3c in (anonymous 
namespace)::NotifySingleListenerIgnoreRE<com::sun::star::document::XEventListener,
 
com::sun::star::document::EventObject>::operator()(com::sun::star::uno::Reference<com::sun::star::document::XEventListener>
 const&) const (this=0x7ffc5044dfc0, listener=uno::Reference to 
(ScVbaEventsHelper *) 0x55b8c2b54870) at 
/home/julien/lo/libreoffice/sfx2/source/doc/sfxbasemodel.cxx:3293
    0x00007f9ef463b8aa in 
comphelper::OInterfaceContainerHelper3<com::sun::star::document::XEventListener>::forEach<(anonymous
 
namespace)::NotifySingleListenerIgnoreRE<com::sun::star::document::XEventListener,
 com::sun::star::document::EventObject> >((anonymous 
namespace)::NotifySingleListenerIgnoreRE<com::sun::star::document::XEventListener,
 com::sun::star::document::EventObject> const&)
    (this=0x55b8c2735c18, func=...) at 
include/comphelper/interfacecontainer3.hxx:279
    0x00007f9ef463b010 in SfxBaseModel::postEvent_Impl(rtl::OUString const&, 
com::sun::star::uno::Reference<com::sun::star::frame::XController2> const&, 
com::sun::star::uno::Any const&)
    (this=0x55b8c2308ae0, aName="OnUnload", xController=empty uno::Reference, 
supplement=uno::Any(void)) at 
/home/julien/lo/libreoffice/sfx2/source/doc/sfxbasemodel.cxx:3338
    0x00007f9ef463a089 in SfxBaseModel::Notify(SfxBroadcaster&, SfxHint const&) 
(this=0x55b8c2308ae0, rBC=..., rHint=...) at 
/home/julien/lo/libreoffice/sfx2/source/doc/sfxbasemodel.cxx:2960
    
    See full bt here:
    https://bugs.documentfoundation.org/attachment.cgi?id=192546
    
    Regression from:
    
https://git.libreoffice.org/core/+/d2fccf0117a37f8aab8bb50ece419987f06af6b9%5E%21
    "cool#6893 improve listeners in SfxBaseModel"
    
    Change-Id: I372808dade20c47275ab599054d8e9572dc3da4d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163356
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins
    (cherry picked from commit 6c6b580428bc527da9af82da743616787617b39b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163345
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
    Tested-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 985af531358d..062c594f2c4f 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -2510,7 +2510,7 @@ void SAL_CALL SfxBaseModel::removeEventListener( const 
Reference< document::XEve
 {
     SfxModelGuard aGuard( *this );
 
-    m_pData->m_aEventListeners.removeInterface( aListener );
+    m_pData->m_aDocumentEventListeners1.removeInterface( aListener );
 }
 
 //  XShapeEventBroadcaster
commit 016b75f8289276468cde320067ae3519fdeb94f4
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Feb 21 19:14:27 2024 +0100
Commit:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
CommitDate: Sun Feb 25 14:30:31 2024 +0100

    tdf#159519 libxmlsec: avoid linking function not existent in Windows 7
    
    xsec_xmlsec.dll is linked to libxmlsec-mscng.dll, which is
    linked to Win32 bcrypt.dll, which doesn't have BCryptKeyDerivation on
    Windows 7.
    
    Use GetProcAddress() to retrieve BCryptKeyDerivation at runtime; the
    function is not used by LibreOffice.
    
    (regression from commit 26bf26272bf525b59b4a4ce18b3ce14c1febfd7b
     and (due to revert) commit bfd479abf0d1d8ce36c3b0dcc6c824216f88a95b)
    
    Change-Id: I0c0c94ee0cdfd48ae7506d9dfb51fcaf8289d460
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163709
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 0690f3b7b981417a7b1f2fffd87c593a2a2a15d5)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163740
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit aacb4fce006b537dade0417c0637fd584f7f2c2a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163761
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
    Tested-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

diff --git a/external/xmlsec/BCryptKeyDerivation.patch.1 
b/external/xmlsec/BCryptKeyDerivation.patch.1
new file mode 100644
index 000000000000..3747915f87d2
--- /dev/null
+++ b/external/xmlsec/BCryptKeyDerivation.patch.1
@@ -0,0 +1,51 @@
+tdf#159519 Windows 7 does not have BCryptKeyDerivation
+
+It just occurred to me that these functions would of course not be called
+by LibreOffice so this is untested.
+
+--- xmlsec/src/mscng/pbkdf2.c.orig     2024-02-21 19:02:56.539534152 +0100
++++ xmlsec/src/mscng/pbkdf2.c  2024-02-21 19:01:03.282270354 +0100
+@@ -318,7 +318,20 @@
+     }
+ 
+     /* generate the output key */
++#if 1 // _WIN32_WINNT <= 0x0601
++    typedef NTSTATUS (WINAPI * BCryptKeyDerivationPtr)(
++        BCRYPT_KEY_HANDLE, BCryptBufferDesc *, PUCHAR, ULONG, ULONG *, ULONG);
++    HMODULE hBCrypt = GetModuleHandle("bcrypt.dll");
++    BCryptKeyDerivationPtr pBCryptKeyDerivation =
++        (BCryptKeyDerivationPtr) GetProcAddress(hBCrypt, 
"BCryptKeyDerivation");
++    if(NULL == pBCryptKeyDerivation) {
++        xmlSecMSCngNtError("BCryptKeyDerivation", NULL, status);
++        goto done;
++    }
++    status = (*pBCryptKeyDerivation)(
++#else
+     status = BCryptKeyDerivation(
++#endif
+         hKey,
+         &paramsPBKDF2,
+         pbOut,
+--- xmlsec/src/mscng/concatkdf.c.orig  2024-02-21 19:02:37.962490885 +0100
++++ xmlsec/src/mscng/concatkdf.c       2024-02-21 19:01:37.961351134 +0100
+@@ -318,7 +318,20 @@
+     }
+ 
+     /* generate the output key */
++#if 1 // _WIN32_WINNT <= 0x0601
++    typedef NTSTATUS (WINAPI * BCryptKeyDerivationPtr)(
++        BCRYPT_KEY_HANDLE, BCryptBufferDesc *, PUCHAR, ULONG, ULONG *, ULONG);
++    HMODULE hBCrypt = GetModuleHandle("bcrypt.dll");
++    BCryptKeyDerivationPtr pBCryptKeyDerivation =
++        (BCryptKeyDerivationPtr) GetProcAddress(hBCrypt, 
"BCryptKeyDerivation");
++    if(NULL == pBCryptKeyDerivation) {
++        xmlSecMSCngNtError("BCryptKeyDerivation", NULL, status);
++        goto done;
++    }
++    status = (*pBCryptKeyDerivation)(
++#else
+     status = BCryptKeyDerivation(
++#endif
+         hKey,
+         &paramsCONCATKDF2,
+         pbOut,
diff --git a/external/xmlsec/UnpackedTarball_xmlsec.mk 
b/external/xmlsec/UnpackedTarball_xmlsec.mk
index 77d3386b27dc..906aece5f7ed 100644
--- a/external/xmlsec/UnpackedTarball_xmlsec.mk
+++ b/external/xmlsec/UnpackedTarball_xmlsec.mk
@@ -10,6 +10,8 @@
 xmlsec_patches :=
 # Remove this when Ubuntu 20.04 is EOL in 2025.
 xmlsec_patches += old-nss.patch.1
+# Remove this when Windows 7 is no longer supported
+xmlsec_patches += BCryptKeyDerivation.patch.1
 
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,xmlsec))
 

Reply via email to