hank5000 / ice4j

Automatically exported from code.google.com/p/ice4j
0 stars 0 forks source link

DATA_INDICATION encode error with STUN(TURN) #25

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. receive data from peer.
2. new message, set message type and put Attribute
3. encode.

What is the expected output? What do you see instead?
I wish get a byte array, but an Exception occured.

What version of the product are you using? On what operating system?
I get latest version source code by svn.(2014-11-24)
I run it on Windows8.1

Please provide any additional information below.
I found the method/function "encode()" in 
"org.ice4j.attribute.DataAttribute.java" maybe has a bug:

byte binValue[] = new byte[HEADER_LENGTH + getDataLength() +
                                   (padding ? (getDataLength() % 4) : 0)];

it should be written so:

byte binValue[] = new byte[HEADER_LENGTH + getDataLength() +
                                   (padding ? ((4-(getDataLength() % 4))% 4) : 0)];

Original issue reported on code.google.com by iYung...@gmail.com on 24 Nov 2014 at 2:26