From f1a75a81e724566e8f4e9c0e264ca548bca03abb Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Mon, 6 Jul 2015 02:02:52 +0200 Subject: catch ArrayIndexOutOfBoundsException in decrypt operation, might be thrown from BouncyCastle --- .../java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java | 7 +++++++ OpenKeychain/src/main/res/values/strings.xml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenKeychain') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java index 7ec447cf6..026d7bb03 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java @@ -167,6 +167,13 @@ public class PgpDecryptVerify extends BaseOperation OperationLog log = new OperationLog(); log.add(LogType.MSG_DC_ERROR_PGP_EXCEPTION, 1); return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log); + } catch (ArrayIndexOutOfBoundsException e) { + // these can happen if assumptions in JcaPGPObjectFactory.nextObject() aren't + // fulfilled, so we need to catch them here to handle this gracefully + Log.d(Constants.TAG, "array index out of bounds", e); + OperationLog log = new OperationLog(); + log.add(LogType.MSG_DC_ERROR_IO, 1); + return new DecryptVerifyResult(DecryptVerifyResult.RESULT_ERROR, log); } catch (IOException e) { Log.d(Constants.TAG, "IOException", e); OperationLog log = new OperationLog(); diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 8b224c37c..f31cac508 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -1105,7 +1105,7 @@ "Integrity check error!" "Missing integrity check! This can happen because the encrypting application is out of date, or from a downgrade attack." "No valid OpenPGP encrypted or signed data found!" - "Encountered IO Exception during operation!" + "Encountered an error reading input data!" "Error opening input data stream!" "No encrypted data found in stream!" "No encrypted data with known secret key found in stream!" -- cgit v1.2.3