Program: 135844
Project: 135844
Buggy source:
@Test public void testDecode_ExtensionHeaders() throws Exception {
  byte[] payload={0x01,0x23,0x45,0x67,(byte)0x89,(byte)0xab,(byte)0xcd,(byte)0xef,0x01,0x23,0x45,0x67,(byte)0x86,(byte)0xdd,0x60,(byte)0xf0,0x00,0x01,0x00,0x15,0x00,(byte)0x0f,0x01,0x23,0x45,0x67,(byte)0x89,(byte)0xab,(byte)0xcd,(byte)0xef,(byte)0xfe,(byte)0xdc,(byte)0xba,(byte)0x98,0x76,0x54,0x32,0x10,(byte)0xfe,(byte)0xdc,(byte)0xba,(byte)0x98,0x76,0x54,0x32,0x10,0x01,0x23,0x45,0x67,(byte)0x89,(byte)0xab,(byte)0xcd,(byte)0xef,0x2b,0x00,(byte)0xab,(byte)0xcd,(byte)0xef,(byte)0x12,(byte)0x34,(byte)0x56,0x11,0x00,(byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,0x01,0x02,0x03,0x04,0x05,(byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff};
  NotificationProviderService npServiceMock=Mockito.mock(NotificationProviderService.class);
  ArrayList<PacketChain> packetChainList=new ArrayList<PacketChain>();
  packetChainList.add(new PacketChainBuilder().setPacket(new RawPacketBuilder().build()).build());
  packetChainList.add(new PacketChainBuilder().setPacket(new EthernetPacketBuilder().setPayloadOffset(14).build()).build());
  Ipv6PacketReceived notification=new Ipv6Decoder(npServiceMock).decode(new EthernetPacketReceivedBuilder().setPacketChain(packetChainList).setPayload(payload).build());
  Ipv6Packet ipv6Packet=(Ipv6Packet)notification.getPacketChain().get(2).getPacket();
  assertEquals(6,ipv6Packet.getVersion().intValue());
  assertEquals(3,ipv6Packet.getDscp().getValue().intValue());
  assertEquals(3,ipv6Packet.getEcn().intValue());
  assertEquals(1,ipv6Packet.getFlowLabel().intValue());
  assertEquals(21,ipv6Packet.getIpv6Length().intValue());
  assertEquals(KnownIpProtocols.Udp,ipv6Packet.getNextHeader());
  assertEquals(15,ipv6Packet.getHopLimit().intValue());
  assertEquals("String_Node_Str",ipv6Packet.getSourceIpv6().getValue());
  assertEquals("String_Node_Str",ipv6Packet.getDestinationIpv6().getValue());
  assertEquals(KnownIpProtocols.Hopopt,ipv6Packet.getExtensionHeaders().get(0).getType());
  assertEquals(0,ipv6Packet.getExtensionHeaders().get(0).getLength().intValue());
  assertTrue(Arrays.equals(ipv6Packet.getExtensionHeaders().get(0).getData(),Arrays.copyOfRange(payload,56,62)));
  assertEquals(KnownIpProtocols.Ipv6Route,ipv6Packet.getExtensionHeaders().get(1).getType());
  assertEquals(0,ipv6Packet.getExtensionHeaders().get(1).getLength().intValue());
  assertTrue(Arrays.equals(ipv6Packet.getExtensionHeaders().get(1).getData(),Arrays.copyOfRange(payload,64,70)));
  assertEquals(70,ipv6Packet.getPayloadOffset().intValue());
  assertEquals(5,ipv6Packet.getPayloadLength().intValue());
  assertTrue(Arrays.equals(payload,notification.getPayload()));
}

Fixed version (ground truth):
@Test public void testDecode_ExtensionHeaders() throws Exception {
  byte[] payload={0x01,0x23,0x45,0x67,(byte)0x89,(byte)0xab,(byte)0xcd,(byte)0xef,0x01,0x23,0x45,0x67,(byte)0x86,(byte)0xdd,0x60,(byte)0xf0,0x00,0x01,0x00,0x15,0x00,(byte)0x0f,0x01,0x23,0x45,0x67,(byte)0x89,(byte)0xab,(byte)0xcd,(byte)0xef,(byte)0xfe,(byte)0xdc,(byte)0xba,(byte)0x98,0x76,0x54,0x32,0x10,(byte)0xfe,(byte)0xdc,(byte)0xba,(byte)0x98,0x76,0x54,0x32,0x10,0x01,0x23,0x45,0x67,(byte)0x89,(byte)0xab,(byte)0xcd,(byte)0xef,0x2b,0x00,(byte)0xab,(byte)0xcd,(byte)0xef,(byte)0x12,(byte)0x34,(byte)0x56,0x11,0x00,(byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,0x01,0x02,0x03,0x04,0x05,(byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff};
  NotificationProviderService npServiceMock=Mockito.mock(NotificationProviderService.class);
  ArrayList<PacketChain> packetChainList=new ArrayList<PacketChain>();
  packetChainList.add(new PacketChainBuilder().setPacket(new RawPacketBuilder().build()).build());
  packetChainList.add(new PacketChainBuilder().setPacket(new EthernetPacketBuilder().setPayloadOffset(14).build()).build());
  Ipv6PacketReceived notification=new Ipv6Decoder(npServiceMock).decode(new EthernetPacketReceivedBuilder().setPacketChain(packetChainList).setPayload(payload).build());
  Ipv6Packet ipv6Packet=(Ipv6Packet)notification.getPacketChain().get(2).getPacket();
  assertEquals(6,ipv6Packet.getVersion().intValue());
  assertEquals(3,ipv6Packet.getDscp().getValue().intValue());
  assertEquals(3,ipv6Packet.getEcn().intValue());
  assertEquals(1,ipv6Packet.getFlowLabel().intValue());
  assertEquals(21,ipv6Packet.getIpv6Length().intValue());
  assertEquals(KnownIpProtocols.Hopopt,ipv6Packet.getNextHeader());
  assertEquals(15,ipv6Packet.getHopLimit().intValue());
  assertEquals("String_Node_Str",ipv6Packet.getSourceIpv6().getValue());
  assertEquals("String_Node_Str",ipv6Packet.getDestinationIpv6().getValue());
  assertEquals(KnownIpProtocols.Ipv6Route,ipv6Packet.getExtensionHeaders().get(0).getNextHeader());
  assertEquals(0,ipv6Packet.getExtensionHeaders().get(0).getLength().intValue());
  assertTrue(Arrays.equals(ipv6Packet.getExtensionHeaders().get(0).getData(),Arrays.copyOfRange(payload,56,62)));
  assertEquals(KnownIpProtocols.Udp,ipv6Packet.getExtensionHeaders().get(1).getNextHeader());
  assertEquals(0,ipv6Packet.getExtensionHeaders().get(1).getLength().intValue());
  assertTrue(Arrays.equals(ipv6Packet.getExtensionHeaders().get(1).getData(),Arrays.copyOfRange(payload,64,70)));
  assertEquals(54,ipv6Packet.getPayloadOffset().intValue());
  assertEquals(21,ipv6Packet.getPayloadLength().intValue());
  assertTrue(Arrays.equals(payload,notification.getPayload()));
}