summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2019-11-21 21:11:02 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-12-04 17:19:54 +0100
commitb64ab30695c5e26d880192dbdde11a8c5ae9ef7f (patch)
tree14aac97e25c8659d813b800f768de2c9b6e71b91
parentd505e72051d3e9a92e94c5c40a9bbb8bb3052dd5 (diff)
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
-rw-r--r--oox/source/core/filterdetect.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx
index 7e72d28482df..f59b15c56df9 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;
}