oox/source/core/filterdetect.cxx |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 5c63257d54023648542ef64e022110b8ca7657ed
Author:     Vasily Melenchuk <vasily.melenc...@cib.de>
AuthorDate: Thu Nov 21 21:11:02 2019 +0300
Commit:     Vasily Melenchuk <vasily.melenc...@cib.de>
CommitDate: Thu Nov 21 21:11:02 2019 +0300

    oox: exception on password veryfy attempt is ending loop
    
    If we receive an exception on createEncryptionData() there is
    no reason to ask user for another password.
    
    Change-Id: I7fa0949c737af20396ae7958e0e80d97af7cfe10

diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx
index 4ee15678538a..9cd0bf3199ea 100644
--- a/oox/source/core/filterdetect.cxx
+++ b/oox/source/core/filterdetect.cxx
@@ -265,8 +265,16 @@ PasswordVerifier::PasswordVerifier( DocumentDecryption& 
aDecryptor ) :
 
 comphelper::DocPasswordVerifierResult PasswordVerifier::verifyPassword( const 
OUString& rPassword, Sequence<NamedValue>& rEncryptionData )
 {
-    if(mDecryptor.generateEncryptionKey(rPassword))
-        rEncryptionData = mDecryptor.createEncryptionData(rPassword);
+    try
+    {
+        if (mDecryptor.generateEncryptionKey(rPassword))
+            rEncryptionData = mDecryptor.createEncryptionData(rPassword);
+    }
+    catch (...)
+    {
+        // Any exception is a reason to abort
+        return comphelper::DocPasswordVerifierResult::Abort;
+    }
 
     return rEncryptionData.hasElements() ? 
comphelper::DocPasswordVerifierResult::OK : 
comphelper::DocPasswordVerifierResult::WrongPassword;
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to