aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/parser
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-08-02 10:40:24 +0200
committerChristian Schneppe <christian@pix-art.de>2016-08-11 21:34:43 +0200
commitca17eb5317c7d00a527b726ea068594393fdb72a (patch)
treee0a9721e7e6f3320e78d0475844be8d4cc5a4313 /src/main/java/de/pixart/messenger/parser
parent3082e9d37380319e0fef4da87a527344f98b26f5 (diff)
handle invalid prekey ids in bundle
Diffstat (limited to 'src/main/java/de/pixart/messenger/parser')
-rw-r--r--src/main/java/de/pixart/messenger/parser/IqParser.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/IqParser.java b/src/main/java/de/pixart/messenger/parser/IqParser.java
index 64fe7395a..8e400680f 100644
--- a/src/main/java/de/pixart/messenger/parser/IqParser.java
+++ b/src/main/java/de/pixart/messenger/parser/IqParser.java
@@ -204,13 +204,15 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived {
Log.d(Config.LOGTAG, AxolotlService.LOGPREFIX+" : "+"Encountered unexpected tag in prekeys list: " + preKeyPublicElement);
continue;
}
- Integer preKeyId = Integer.valueOf(preKeyPublicElement.getAttribute("preKeyId"));
+ Integer preKeyId = null;
try {
- ECPublicKey preKeyPublic = Curve.decodePoint(Base64.decode(preKeyPublicElement.getContent(), Base64.DEFAULT), 0);
+ preKeyId = Integer.valueOf(preKeyPublicElement.getAttribute("preKeyId"));
+ final ECPublicKey preKeyPublic = Curve.decodePoint(Base64.decode(preKeyPublicElement.getContent(), Base64.DEFAULT), 0);
preKeyRecords.put(preKeyId, preKeyPublic);
+ } catch (NumberFormatException e) {
+ Log.e(Config.LOGTAG, AxolotlService.LOGPREFIX+" : "+"could not parse preKeyId from preKey "+preKeyPublicElement.toString());
} catch (Throwable e) {
Log.e(Config.LOGTAG, AxolotlService.LOGPREFIX+" : "+"Invalid preKeyPublic (ID="+preKeyId+") in PEP: "+ e.getMessage()+", skipping...");
- continue;
}
}
return preKeyRecords;