Details
-
Bug
-
Status: Resolved
-
Resolution: Done
-
Helium
-
None
-
None
-
Operating System: Linux
Platform: PC
-
1805
Description
ICMP.computeChecksum() causes ArrayIndexOutOfBoundsException if the size of
payload is odd.
java.lang.ArrayIndexOutOfBoundsException: 49
at org.opendaylight.controller.sal.packet.ICMP.computeChecksum(ICMP.java:199)
at org.opendaylight.controller.sal.packet.ICMP.postSerializeCustomOperation(ICMP.java:210)
at org.opendaylight.controller.sal.packet.Packet.serialize(Packet.java:194)
In this case the payload needs to be padded with a zero octet for computing
the checksum.
In addition, ICMP.computeChecksum() clears carry bits of the 16-bit checksum
incorrectly.
carry = (sum >> 16) & 0xFF; <===
finalSum = (sum & 0xFFFF) + carry;
return (short) ~((short) finalSum & 0xFFFF);
So it generates incorrect checksum if the 16-bit checksum overflows
more than 255 times.