Uploaded image for project: 'controller'
  1. controller
  2. CONTROLLER-806

ICMP.computeChecksum() may cause ArrayIndexOutOfBoundsException.

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • Helium
    • None
    • adsal
    • 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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            yasuda Shigeru Yasuda
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: