mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 19:22:14 -05:00
Silently fail on import on key import with ArrayIndexOutOfBoundsException
This commit is contained in:
parent
81935fe99b
commit
d09d4296da
@ -41,6 +41,7 @@ import org.sufficientlysecure.keychain.util.IterableIterator;
|
|||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
import org.sufficientlysecure.keychain.util.Utf8Util;
|
import org.sufficientlysecure.keychain.util.Utf8Util;
|
||||||
|
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -160,11 +161,15 @@ public class UncachedKeyRing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
while(stream.available() > 0) {
|
while (stream.available() > 0) {
|
||||||
// if there are no objects left from the last factory, create a new one
|
// if there are no objects left from the last factory, create a new one
|
||||||
if (mObjectFactory == null) {
|
if (mObjectFactory == null) {
|
||||||
mObjectFactory = new PGPObjectFactory(PGPUtil.getDecoderStream(stream),
|
InputStream in = PGPUtil.getDecoderStream(stream);
|
||||||
new JcaKeyFingerprintCalculator());
|
if (!BufferedInputStream.class.isInstance(in)) {
|
||||||
|
in = new BufferedInputStream(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
mObjectFactory = new PGPObjectFactory(in, new JcaKeyFingerprintCalculator());
|
||||||
}
|
}
|
||||||
|
|
||||||
// go through all objects in this block
|
// go through all objects in this block
|
||||||
@ -184,9 +189,10 @@ public class UncachedKeyRing {
|
|||||||
mObjectFactory = null;
|
mObjectFactory = null;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(Constants.TAG, "IOException while processing stream", e);
|
Log.e(Constants.TAG, "IOException while processing stream. ArmoredInputStream CRC check failed?", e);
|
||||||
|
} catch (ArrayIndexOutOfBoundsException e) {
|
||||||
|
Log.e(Constants.TAG, "ArmoredInputStream decode failed, symbol is not in decodingTable!", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,16 +102,16 @@ public class CertifyKeySpinner extends KeySpinner {
|
|||||||
@Override
|
@Override
|
||||||
boolean setStatus(Context context, Cursor cursor, ImageView statusView) {
|
boolean setStatus(Context context, Cursor cursor, ImageView statusView) {
|
||||||
if (cursor.getInt(mIndexIsRevoked) != 0) {
|
if (cursor.getInt(mIndexIsRevoked) != 0) {
|
||||||
KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_REVOKED, false);
|
KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_REVOKED, true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (cursor.getInt(mIndexIsExpired) != 0) {
|
if (cursor.getInt(mIndexIsExpired) != 0) {
|
||||||
KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_EXPIRED, false);
|
KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_EXPIRED, true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// don't invalidate the "None" entry, which is also null!
|
// don't invalidate the "None" entry, which is also null!
|
||||||
if (cursor.getPosition() != 0 && cursor.isNull(mIndexHasCertify)) {
|
if (cursor.getPosition() != 0 && cursor.isNull(mIndexHasCertify)) {
|
||||||
KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_UNAVAILABLE, false);
|
KeyFormattingUtils.setStatusImage(getContext(), statusView, null, KeyFormattingUtils.STATE_UNAVAILABLE, true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user