xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit bb692dd15d3c32e85f193c3f60c7917f2b1e13d2
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Tue Dec 13 08:51:59 2022 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Tue Dec 20 08:16:37 2022 +0000

    Use SecurityEnvironmentGpg's XUnoTunnel instead of dynamic_cast
    
    ...where 88ac77c0bc21accfd6f5c404217c3c2aaef2d674 "gpg4libre: List and view 
GPG
    keys" had introduced SecurityEnvironmentGpg complete with (apparently 
unused)
    XUnoTunnel, but then cae5f2a543b31552ccd9765aca5eb514fa694e07 "gpg4libre:
    initial GPG signature generation" and 
0e226d4c193824d79f71d6918038de48afffaf26
    "gpg4libre: initial GPG signature validation" had failed to make use of it.
    (See the upcoming commit introducing loplugin:unocast on why such 
dynamic_casts
    from UNO types are dangerous.)
    
    Change-Id: I29cc5c1cec9c2e98528c7257993f300d131bf41c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144509
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx 
b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
index ebe113c73175..1afcd3c88a57 100644
--- a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
+++ b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
@@ -95,7 +95,7 @@ SAL_CALL XMLSignature_GpgImpl::generate(
 
     //Get Keys Manager
     SecurityEnvironmentGpg* pSecEnv =
-        dynamic_cast<SecurityEnvironmentGpg*>(aEnvironment.get());
+        comphelper::getFromUnoTunnel<SecurityEnvironmentGpg>(aEnvironment);
     if( pSecEnv == nullptr )
         throw RuntimeException() ;
 
@@ -306,7 +306,7 @@ SAL_CALL XMLSignature_GpgImpl::validate(
         Reference< XSecurityEnvironment > aEnvironment = 
aSecurityCtx->getSecurityEnvironmentByIndex(i);
 
         SecurityEnvironmentGpg* pSecEnv =
-            dynamic_cast<SecurityEnvironmentGpg*>(aEnvironment.get());
+            comphelper::getFromUnoTunnel<SecurityEnvironmentGpg>(aEnvironment);
         if( pSecEnv == nullptr )
             throw RuntimeException() ;
 

Reply via email to