diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Ice/ConnectionI.java | 11 | ||||
-rw-r--r-- | java/src/IceInternal/ThreadPool.java | 10 |
2 files changed, 17 insertions, 4 deletions
diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java index a398fb5db1b..c65d91082df 100644 --- a/java/src/Ice/ConnectionI.java +++ b/java/src/Ice/ConnectionI.java @@ -2105,7 +2105,13 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne _transceiver.read(stream, -1); int pos = stream.pos(); - assert(pos >= IceInternal.Protocol.headerSize); + if(pos < IceInternal.Protocol.headerSize) + { + // + // This situation is possible for small UDP packets. + // + throw new IllegalMessageSizeException(); + } stream.pos(0); byte[] m = stream.readBlob(4); if(m[0] != IceInternal.Protocol.magic[0] || m[1] != IceInternal.Protocol.magic[1] || @@ -2185,8 +2191,9 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne { if(_warn) { - _logger.warning("udp connection exception:\n" + ex + _desc); + _logger.warning("datagram connection exception:\n" + ex + "\n" + _desc); } + continue; } else { diff --git a/java/src/IceInternal/ThreadPool.java b/java/src/IceInternal/ThreadPool.java index 0a2a2f9816d..e501e92e7f5 100644 --- a/java/src/IceInternal/ThreadPool.java +++ b/java/src/IceInternal/ThreadPool.java @@ -723,7 +723,7 @@ public final class ThreadPool { if(_instance.properties().getPropertyAsInt("Ice.Warn.Connections") > 0) { - _instance.logger().warning("datagram connection exception:\n" + ex + + _instance.logger().warning("datagram connection exception:\n" + ex + "\n" + handler.toString()); } } @@ -900,7 +900,13 @@ public final class ThreadPool } int pos = stream.pos(); - assert(pos >= Protocol.headerSize); + if(pos < Protocol.headerSize) + { + // + // This situation is possible for small UDP packets. + // + throw new Ice.IllegalMessageSizeException(); + } stream.pos(0); byte[] m = new byte[4]; m[0] = stream.readByte(); |