From 592519c45ceee29608afb45391d6481402195a3d Mon Sep 17 00:00:00 2001 From: jrandom Date: Sat, 19 Jun 2004 23:56:41 +0000 Subject: [PATCH] somehow some people are getting situations where the payload doesnt decompress. wtf? do i need to wrap the Input/Output streams we use to pipe data over the net with a verification wrapper for the messages? e.g. prefix the serialization of all I2NPMessages sent on the wire with the SHA256 of that serialization and verify on read? Ho hum, dunno. maybe its something else, but the ElG/AES+SessionTag already has integrity verification so the only thing I can think of is a checksum error that got past TCP's checking and corrupted the AES stream. --- .../java/src/net/i2p/data/i2np/DatabaseSearchReplyMessage.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/router/java/src/net/i2p/data/i2np/DatabaseSearchReplyMessage.java b/router/java/src/net/i2p/data/i2np/DatabaseSearchReplyMessage.java index e1c2d6d45..365ce3094 100644 --- a/router/java/src/net/i2p/data/i2np/DatabaseSearchReplyMessage.java +++ b/router/java/src/net/i2p/data/i2np/DatabaseSearchReplyMessage.java @@ -70,6 +70,8 @@ public class DatabaseSearchReplyMessage extends I2NPMessageImpl { if (read != compressedLength) throw new IOException("Not enough data to decompress"); byte decompressedData[] = DataHelper.decompress(compressedData); + if (decompressedData == null) + throw new I2NPMessageException("Could not decompress the " + compressedLength + "bytes of data"); ByteArrayInputStream bais = new ByteArrayInputStream(decompressedData); int num = (int)DataHelper.readLong(bais, 1); _routerInfoStructures.clear();