catch ArrayIndexOutOfBoundsException in decrypt operation, might be thrown from BouncyCastle

This commit is contained in:
Vincent Breitmoser
2015-07-06 02:02:52 +02:00
parent 922d4c6a96
commit f1a75a81e7
2 changed files with 8 additions and 1 deletions

View File

@@ -167,6 +167,13 @@ public class PgpDecryptVerify extends BaseOperation<PgpDecryptVerifyInputParcel>
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();