Program: 52560
Project: 52560
Buggy source:
private byte[] decryptBlock(byte[] in_enc,int inOff,int inLen) throws InvalidCipherTextException {
  byte[] M=null, K=null, K1=null, K2=null;
  int len;
  if (inLen <= (macKeySize / 8)) {
    throw new InvalidCipherTextException("String_Node_Str");
  }
  if (cipher == null) {
    K1=new byte[inLen - V.length - mac.getMacSize()];
    K2=new byte[param.getMacKeySize() / 8];
    K=new byte[K1.length + K2.length];
    kdf.generateBytes(K,0,K.length);
    if (V.length != 0) {
      System.arraycopy(K,0,K2,0,K2.length);
      System.arraycopy(K,K2.length,K1,0,K1.length);
    }
 else {
      System.arraycopy(K,0,K1,0,K1.length);
      System.arraycopy(K,K1.length,K2,0,K2.length);
    }
    M=new byte[K1.length];
    for (int i=0; i != K1.length; i++) {
      M[i]=(byte)(in_enc[inOff + V.length + i] ^ K1[i]);
    }
    len=K1.length;
  }
 else {
    K1=new byte[((IESWithCipherParameters)param).getCipherKeySize() / 8];
    K2=new byte[param.getMacKeySize() / 8];
    K=new byte[K1.length + K2.length];
    kdf.generateBytes(K,0,K.length);
    System.arraycopy(K,0,K1,0,K1.length);
    System.arraycopy(K,K1.length,K2,0,K2.length);
    if (nonce != null) {
      byte[] IV=((Nonce)nonce).nextNonce();
      cipher.init(false,new ParametersWithIV(new KeyParameter(K1),IV));
    }
 else {
      cipher.init(false,new KeyParameter(K1));
    }
    M=new byte[cipher.getOutputSize(inLen - V.length - mac.getMacSize())];
    len=cipher.processBytes(in_enc,inOff + V.length,inLen - V.length - mac.getMacSize(),M,0);
    len+=cipher.doFinal(M,len);
  }
  byte[] P2=param.getEncodingV();
  byte[] L2=new byte[4];
  if (V.length != 0 && P2 != null) {
    Pack.intToBigEndian(P2.length * 8,L2,0);
  }
  int end=inOff + inLen;
  byte[] T1=Arrays.copyOfRange(in_enc,end - mac.getMacSize(),end);
  byte[] T2=new byte[T1.length];
  mac.init(new KeyParameter(K2));
  mac.update(in_enc,inOff + V.length,inLen - V.length - T2.length);
  if (P2 != null) {
    mac.update(P2,0,P2.length);
  }
  if (V.length != 0) {
    mac.update(L2,0,L2.length);
  }
  mac.doFinal(T2,0);
  if (!Arrays.constantTimeAreEqual(T1,T2)) {
    throw new InvalidCipherTextException("String_Node_Str");
  }
  return Arrays.copyOfRange(M,0,len);
}

Fixed version (ground truth):
private byte[] decryptBlock(byte[] in_enc,int inOff,int inLen) throws InvalidCipherTextException {
  byte[] M=null, K=null, K1=null, K2=null;
  int len;
  if (inLen <= (param.getMacKeySize() / 8)) {
    throw new InvalidCipherTextException("String_Node_Str");
  }
  if (cipher == null) {
    K1=new byte[inLen - V.length - mac.getMacSize()];
    K2=new byte[param.getMacKeySize() / 8];
    K=new byte[K1.length + K2.length];
    kdf.generateBytes(K,0,K.length);
    if (V.length != 0) {
      System.arraycopy(K,0,K2,0,K2.length);
      System.arraycopy(K,K2.length,K1,0,K1.length);
    }
 else {
      System.arraycopy(K,0,K1,0,K1.length);
      System.arraycopy(K,K1.length,K2,0,K2.length);
    }
    M=new byte[K1.length];
    for (int i=0; i != K1.length; i++) {
      M[i]=(byte)(in_enc[inOff + V.length + i] ^ K1[i]);
    }
    len=K1.length;
  }
 else {
    K1=new byte[((IESWithCipherParameters)param).getCipherKeySize() / 8];
    K2=new byte[param.getMacKeySize() / 8];
    K=new byte[K1.length + K2.length];
    kdf.generateBytes(K,0,K.length);
    System.arraycopy(K,0,K1,0,K1.length);
    System.arraycopy(K,K1.length,K2,0,K2.length);
    if (nonce != null) {
      byte[] IV=((Nonce)nonce).nextNonce();
      cipher.init(false,new ParametersWithIV(new KeyParameter(K1),IV));
    }
 else {
      cipher.init(false,new KeyParameter(K1));
    }
    M=new byte[cipher.getOutputSize(inLen - V.length - mac.getMacSize())];
    len=cipher.processBytes(in_enc,inOff + V.length,inLen - V.length - mac.getMacSize(),M,0);
    len+=cipher.doFinal(M,len);
  }
  byte[] P2=param.getEncodingV();
  byte[] L2=new byte[4];
  if (V.length != 0 && P2 != null) {
    Pack.intToBigEndian(P2.length * 8,L2,0);
  }
  int end=inOff + inLen;
  byte[] T1=Arrays.copyOfRange(in_enc,end - mac.getMacSize(),end);
  byte[] T2=new byte[T1.length];
  mac.init(new KeyParameter(K2));
  mac.update(in_enc,inOff + V.length,inLen - V.length - T2.length);
  if (P2 != null) {
    mac.update(P2,0,P2.length);
  }
  if (V.length != 0) {
    mac.update(L2,0,L2.length);
  }
  mac.doFinal(T2,0);
  if (!Arrays.constantTimeAreEqual(T1,T2)) {
    throw new InvalidCipherTextException("String_Node_Str");
  }
  return Arrays.copyOfRange(M,0,len);
}