Catch exceptions thrown during signature checking. Some versions of Android cannot reliably check ECDSA signatures! Resolves issue 160.

This commit is contained in:
Mike Hearn 2012-03-26 15:39:10 +02:00
parent 58971b6728
commit a77d071d35

View File

@ -237,10 +237,17 @@ public class Peer {
}
private void processAlert(AlertMessage m) {
if (m.isSignatureValid()) {
log.info("Received alert from peer {}: {}", toString(), m.getStatusBar());
} else {
log.warn("Received alert with invalid signature from peer {}: {}", toString(), m.getStatusBar());
try {
if (m.isSignatureValid()) {
log.info("Received alert from peer {}: {}", toString(), m.getStatusBar());
} else {
log.warn("Received alert with invalid signature from peer {}: {}", toString(), m.getStatusBar());
}
} catch (Throwable t) {
// Signature checking can FAIL on Android platforms before Gingerbread apparently due to bugs in their
// BigInteger implementations! See issue 160 for discussion. As alerts are just optional and not that
// useful, we just swallow the error here.
log.error("Failed to check signature: bug in platform libraries?", t);
}
}