From cd15d7499d37a3198b08ca2e815aca19e1a9618b Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 5 Jan 2013 12:53:45 +0000 Subject: [PATCH] Fix erroneous cast from byte to int in IBBInputStream's read() method. The casted value needs to be masked with 0xff, because bytes in java are signed (two's complement) Fixes SMACK-394 git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13387 b35dd754-fafc-0310-a699-88a17e54d16e --- .../smackx/bytestreams/ibb/InBandBytestreamSession.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java b/source/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java index 1cced78b2..a33682c87 100644 --- a/source/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java +++ b/source/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java @@ -287,7 +287,7 @@ public class InBandBytestreamSession implements BytestreamSession { } // return byte and increment buffer pointer - return (int) buffer[bufferPointer++]; + return ((int) buffer[bufferPointer++]) & 0xff; } public synchronized int read(byte[] b, int off, int len) throws IOException {