nus-yam/ex-repair huggingface dataset:
Program: 52386
Project: 52386
Buggy source:
/** 
 * which generates the p and g values from the given parameters, returning the DSAParameters object. <p> Note: can take a while...
 */
public DSAParameters generateParameters(){
  return (use186_3) ? generateParameters_FIPS186_3() : generateParameters_FIPS186_2();
}

Fixed version (ground truth):
/** 
 * which generates the p and g values from the given parameters, returning the DSAParameters object. <p> Note: can take a while...
 * @return a generated DSA parameters object.
 */
public DSAParameters generateParameters(){
  return (use186_3) ? generateParameters_FIPS186_3() : generateParameters_FIPS186_2();
}
Program: 52387
Project: 52387
Buggy source:
/** 
 * which generates the p and g values from the given parameters, returning the ElGamalParameters object. <p> Note: can take a while...
 */
public ElGamalParameters generateParameters(){
  BigInteger[] safePrimes=DHParametersHelper.generateSafePrimes(size,certainty,random);
  BigInteger p=safePrimes[0];
  BigInteger q=safePrimes[1];
  BigInteger g=DHParametersHelper.selectGenerator(p,q,random);
  return new ElGamalParameters(p,g);
}

Fixed version (ground truth):
/** 
 * which generates the p and g values from the given parameters, returning the ElGamalParameters object. <p> Note: can take a while...
 * @return a generated ElGamal parameters object.
 */
public ElGamalParameters generateParameters(){
  BigInteger[] safePrimes=DHParametersHelper.generateSafePrimes(size,certainty,random);
  BigInteger p=safePrimes[0];
  BigInteger q=safePrimes[1];
  BigInteger g=DHParametersHelper.selectGenerator(p,q,random);
  return new ElGamalParameters(p,g);
}
Program: 52388
Project: 52388
Buggy source:
/** 
 * Procedure C procedure generates the a value from the given p,q, returning the a value.
 */
private BigInteger procedure_C(BigInteger p,BigInteger q){
  BigInteger pSub1=p.subtract(ONE);
  BigInteger pSub1DivQ=pSub1.divide(q);
  int length=p.bitLength();
  for (; ; ) {
    BigInteger d=new BigInteger(length,init_random);
    if (d.compareTo(ONE) > 0 && d.compareTo(pSub1) < 0) {
      BigInteger a=d.modPow(pSub1DivQ,p);
      if (a.compareTo(ONE) != 0) {
        return a;
      }
    }
  }
}

Fixed version (ground truth):
private BigInteger procedure_C(BigInteger p,BigInteger q){
  BigInteger pSub1=p.subtract(ONE);
  BigInteger pSub1DivQ=pSub1.divide(q);
  int length=p.bitLength();
  for (; ; ) {
    BigInteger d=new BigInteger(length,init_random);
    if (d.compareTo(ONE) > 0 && d.compareTo(pSub1) < 0) {
      BigInteger a=d.modPow(pSub1DivQ,p);
      if (a.compareTo(ONE) != 0) {
        return a;
      }
    }
  }
}
Program: 52389
Project: 52389
Buggy source:
/** 
 * which generates the p , q and a values from the given parameters, returning the GOST3410Parameters object.
 */
public GOST3410Parameters generateParameters(){
  BigInteger[] pq=new BigInteger[2];
  BigInteger q=null, p=null, a=null;
  int x0, c;
  long x0L, cL;
  if (typeproc == 1) {
    x0=init_random.nextInt();
    c=init_random.nextInt();
switch (size) {
case 512:
      procedure_A(x0,c,pq,512);
    break;
case 1024:
  procedure_B(x0,c,pq);
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
p=pq[0];
q=pq[1];
a=procedure_C(p,q);
return new GOST3410Parameters(p,q,a,new GOST3410ValidationParameters(x0,c));
}
 else {
x0L=init_random.nextLong();
cL=init_random.nextLong();
switch (size) {
case 512:
procedure_Aa(x0L,cL,pq,512);
break;
case 1024:
procedure_Bb(x0L,cL,pq);
break;
default :
throw new IllegalStateException("String_Node_Str");
}
p=pq[0];
q=pq[1];
a=procedure_C(p,q);
return new GOST3410Parameters(p,q,a,new GOST3410ValidationParameters(x0L,cL));
}
}

Fixed version (ground truth):
/** 
 * which generates the p , q and a values from the given parameters, returning the GOST3410Parameters object.
 * @return a generated GOST3410 parameters object.
 */
public GOST3410Parameters generateParameters(){
  BigInteger[] pq=new BigInteger[2];
  BigInteger q=null, p=null, a=null;
  int x0, c;
  long x0L, cL;
  if (typeproc == 1) {
    x0=init_random.nextInt();
    c=init_random.nextInt();
switch (size) {
case 512:
      procedure_A(x0,c,pq,512);
    break;
case 1024:
  procedure_B(x0,c,pq);
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
p=pq[0];
q=pq[1];
a=procedure_C(p,q);
return new GOST3410Parameters(p,q,a,new GOST3410ValidationParameters(x0,c));
}
 else {
x0L=init_random.nextLong();
cL=init_random.nextLong();
switch (size) {
case 512:
procedure_Aa(x0L,cL,pq,512);
break;
case 1024:
procedure_Bb(x0L,cL,pq);
break;
default :
throw new IllegalStateException("String_Node_Str");
}
p=pq[0];
q=pq[1];
a=procedure_C(p,q);
return new GOST3410Parameters(p,q,a,new GOST3410ValidationParameters(x0L,cL));
}
}
Program: 52390
Project: 52390
Buggy source:
/** 
 * Generate a key using the scrypt key derivation function.
 * @param P the bytes of the pass phrase.
 * @param S the salt to use for this invocation.
 * @param N CPU/Memory cost parameter. Must be larger than 1, a power of 2 and less than<code>2^(128 * r / 8)</code>.
 * @param r the block size, must be >= 1.
 * @param p Parallelization parameter. Must be a positive integer less than or equal to<code>Integer.MAX_VALUE / (128 * r * 8)</code>.
 * @param dkLen the length of the key to generate.
 * @return the generated key.
 */
public static byte[] generate(byte[] P,byte[] S,int N,int r,int p,int dkLen){
  if (P == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (S == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (N <= 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (r == 1 && N > 65536) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (r < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int maxParallel=Integer.MAX_VALUE / (128 * r * 8);
  if (p < 1 || p > maxParallel) {
    throw new IllegalArgumentException("String_Node_Str" + maxParallel + "String_Node_Str"+ r+ "String_Node_Str");
  }
  if (dkLen < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return MFcrypt(P,S,N,r,p,dkLen);
}

Fixed version (ground truth):
/** 
 * Generate a key using the scrypt key derivation function.
 * @param P the bytes of the pass phrase.
 * @param S the salt to use for this invocation.
 * @param N CPU/Memory cost parameter. Must be larger than 1, a power of 2 and less than<code>2^(128 * r / 8)</code>.
 * @param r the block size, must be &gt;= 1.
 * @param p Parallelization parameter. Must be a positive integer less than or equal to<code>Integer.MAX_VALUE / (128 * r * 8)</code>.
 * @param dkLen the length of the key to generate.
 * @return the generated key.
 */
public static byte[] generate(byte[] P,byte[] S,int N,int r,int p,int dkLen){
  if (P == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (S == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (N <= 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (r == 1 && N > 65536) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (r < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int maxParallel=Integer.MAX_VALUE / (128 * r * 8);
  if (p < 1 || p > maxParallel) {
    throw new IllegalArgumentException("String_Node_Str" + maxParallel + "String_Node_Str"+ r+ "String_Node_Str");
  }
  if (dkLen < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return MFcrypt(P,S,N,r,p,dkLen);
}
Program: 52391
Project: 52391
Buggy source:
/** 
 * Return the   {@link ProtocolVersion} to use for the <c>TLSPlaintext.version</c> field prior toreceiving the server version. NOTE: This method is <b>not</b> called for DTLS. <p> See RFC 5246 E.1.: "TLS clients that wish to negotiate with older servers MAY send any value {03,XX} as the record layer version number. Typical values would be {03,00}, the lowest version number supported by the client, and the value of ClientHello.client_version. No single value will guarantee interoperability with all old servers, but this is a complex topic beyond the scope of this document." </p>
 * @return The {@link ProtocolVersion} to use.
 */
ProtocolVersion getClientHelloRecordLayerVersion();

Fixed version (ground truth):
/** 
 * Return the   {@link ProtocolVersion} to use for the <code>TLSPlaintext.version</code> field prior toreceiving the server version. NOTE: This method is <b>not</b> called for DTLS. <p> See RFC 5246 E.1.: "TLS clients that wish to negotiate with older servers MAY send any value {03,XX} as the record layer version number. Typical values would be {03,00}, the lowest version number supported by the client, and the value of ClientHello.client_version. No single value will guarantee interoperability with all old servers, but this is a complex topic beyond the scope of this document." </p>
 * @return The {@link ProtocolVersion} to use.
 */
ProtocolVersion getClientHelloRecordLayerVersion();
Program: 52392
Project: 52392
Buggy source:
/** 
 * Constructor for non-blocking mode.<br> <br> When data is received, use   {@link #offerInput(java.nio.ByteBuffer)} toprovide the received ciphertext, then use {@link #readInput(byte[],int,int)} to read the corresponding cleartext.<br><br> Similarly, when data needs to be sent, use {@link #offerOutput(byte[],int,int)} to provide the cleartext, then use{@link #readOutput(byte[],int,int)} to get the correspondingciphertext.
 * @param secureRandom Random number generator for various cryptographic functions
 */
public TlsClientProtocol(SecureRandom secureRandom){
  super(secureRandom);
}

Fixed version (ground truth):
/** 
 * Constructor for non-blocking mode.<br> <br> When data is received, use offerInput(java.nio.ByteBuffer) to provide the received ciphertext, then use  {@link #readInput(byte[],int,int)} to read the corresponding cleartext.<br><br> Similarly, when data needs to be sent, use {@link #offerOutput(byte[],int,int)} to provide the cleartext, then use{@link #readOutput(byte[],int,int)} to get the correspondingciphertext.
 * @param secureRandom Random number generator for various cryptographic functions
 */
public TlsClientProtocol(SecureRandom secureRandom){
  super(secureRandom);
}
Program: 52393
Project: 52393
Buggy source:
/** 
 * Constructor for non-blocking mode.<br> <br> When data is received, use   {@link #offerInput(java.nio.ByteBuffer)} toprovide the received ciphertext, then use {@link #readInput(byte[],int,int)} to read the corresponding cleartext.<br><br> Similarly, when data needs to be sent, use {@link #offerOutput(byte[],int,int)} to provide the cleartext, then use{@link #readOutput(byte[],int,int)} to get the correspondingciphertext.
 * @param secureRandom Random number generator for various cryptographic functions
 */
public TlsServerProtocol(SecureRandom secureRandom){
  super(secureRandom);
}

Fixed version (ground truth):
/** 
 * Constructor for non-blocking mode.<br> <br> When data is received, use offerInput(java.nio.ByteBuffer) to provide the received ciphertext, then use  {@link #readInput(byte[],int,int)} to read the corresponding cleartext.<br><br> Similarly, when data needs to be sent, use {@link #offerOutput(byte[],int,int)} to provide the cleartext, then use{@link #readOutput(byte[],int,int)} to get the correspondingciphertext.
 * @param secureRandom Random number generator for various cryptographic functions
 */
public TlsServerProtocol(SecureRandom secureRandom){
  super(secureRandom);
}
Program: 52400
Project: 52400
Buggy source:
public boolean verifySignature(byte[] message,BigInteger r,BigInteger s){
  BigInteger n=ecParams.getN();
  if (r.compareTo(ONE) < 0 || r.compareTo(n) > 0) {
    return false;
  }
  if (s.compareTo(ONE) < 0 || s.compareTo(n) > 0) {
    return false;
  }
  ECPoint q=((ECPublicKeyParameters)ecKey).getQ();
  SM3Digest digest=new SM3Digest();
  byte[] z=getZ(digest);
  digest.update(z,0,z.length);
  digest.update(message,0,message.length);
  byte[] eHash=new byte[digest.getDigestSize()];
  digest.doFinal(eHash,0);
  BigInteger e=calculateE(eHash);
  BigInteger t=r.add(s).mod(n);
  if (t.equals(ZERO)) {
    return false;
  }
 else {
    ECPoint x1y1=ecParams.getG().multiply(s);
    x1y1=x1y1.add(q.multiply(t)).normalize();
    return r.equals(e.add(x1y1.getAffineXCoord().toBigInteger()).mod(n));
  }
}

Fixed version (ground truth):
public boolean verifySignature(byte[] message,BigInteger r,BigInteger s){
  BigInteger n=ecParams.getN();
  if (r.compareTo(ONE) < 0 || r.compareTo(n) >= 0) {
    return false;
  }
  if (s.compareTo(ONE) < 0 || s.compareTo(n) >= 0) {
    return false;
  }
  ECPoint q=((ECPublicKeyParameters)ecKey).getQ();
  SM3Digest digest=new SM3Digest();
  byte[] z=getZ(digest);
  digest.update(z,0,z.length);
  digest.update(message,0,message.length);
  byte[] eHash=new byte[digest.getDigestSize()];
  digest.doFinal(eHash,0);
  BigInteger e=calculateE(eHash);
  BigInteger t=r.add(s).mod(n);
  if (t.equals(ZERO)) {
    return false;
  }
 else {
    ECPoint x1y1=ecParams.getG().multiply(s);
    x1y1=x1y1.add(q.multiply(t)).normalize();
    return r.equals(e.add(x1y1.getAffineXCoord().toBigInteger()).mod(n));
  }
}
Program: 52401
Project: 52401
Buggy source:
public void performTest() throws Exception {
  doSignerTestFp();
  doSignerTestF2m();
}

Fixed version (ground truth):
public void performTest() throws Exception {
  doSignerTestFp();
  doSignerTestF2m();
  doVerifyBoundsCheck();
}
Program: 52403
Project: 52403
Buggy source:
private byte[] pad(byte[] in,int inOff,int len){
  byte[] padded;
  if (len % blockSize == 0) {
    padded=new byte[len + blockSize];
  }
 else {
    int blocks=len / blockSize;
    padded=new byte[(blocks * blockSize) + blockSize];
  }
  System.arraycopy(in,inOff,padded,0,len);
  padded[len]=(byte)0x80;
  intToBytes(inputLength * BITS_IN_BYTE,padded,padded.length - 12);
  return padded;
}

Fixed version (ground truth):
private byte[] pad(byte[] in,int inOff,int len){
  byte[] padded;
  if (blockSize - len < 12) {
    padded=new byte[2 * blockSize];
  }
 else {
    padded=new byte[blockSize];
  }
  System.arraycopy(in,inOff,padded,0,len);
  padded[len]=(byte)0x80;
  Pack.longToLittleEndian(inputLength * BITS_IN_BYTE,padded,padded.length - 12);
  return padded;
}
Program: 52404
Project: 52404
Buggy source:
public void reset(){
  for (int bufferIndex=0; bufferIndex < state.length; bufferIndex++) {
    state[bufferIndex]=new byte[columns];
  }
  state[0][0]=(byte)state.length;
  Arrays.fill(padded,(byte)0);
}

Fixed version (ground truth):
public void reset(){
  for (int bufferIndex=0; bufferIndex < state.length; bufferIndex++) {
    state[bufferIndex]=new byte[columns];
  }
  state[0][0]=(byte)state.length;
  inputLength=0;
  Arrays.fill(padded,(byte)0);
}
Program: 52405
Project: 52405
Buggy source:
private byte[] pad(){
  byte[] padded=new byte[engine.getByteLength() - (inputLength % engine.getByteLength())];
  padded[0]=(byte)0x80;
  intToBytes(inputLength * BITS_IN_BYTE,padded,padded.length - 12);
  engine.update(padded,0,padded.length);
  return padded;
}

Fixed version (ground truth):
private void pad(){
  int extra=engine.getByteLength() - (int)(inputLength % engine.getByteLength());
  if (extra < 12) {
    extra=engine.getByteLength();
  }
  byte[] padded=new byte[extra];
  padded[0]=(byte)0x80;
  Pack.longToLittleEndian(inputLength * BITS_IN_BYTE,padded,padded.length - 12);
  engine.update(padded,0,padded.length);
}
Program: 52406
Project: 52406
Buggy source:
public DSTU7564Mac(int macBitSize){
  this.engine=new DSTU7564Digest(macBitSize);
  this.macSize=macBitSize / BITS_IN_BYTE;
  this.paddedKey=null;
  this.invertedKey=null;
  this.paddedIn=null;
}

Fixed version (ground truth):
public DSTU7564Mac(int macBitSize){
  this.engine=new DSTU7564Digest(macBitSize);
  this.macSize=macBitSize / BITS_IN_BYTE;
  this.paddedKey=null;
  this.invertedKey=null;
}
Program: 52407
Project: 52407
Buggy source:
private byte[] padKey(byte[] in,int inOff,int len){
  byte[] padded;
  if (len % engine.getByteLength() == 0) {
    padded=new byte[len + engine.getByteLength()];
  }
 else {
    int blocks=len / engine.getByteLength();
    padded=new byte[(blocks * engine.getByteLength()) + engine.getByteLength()];
  }
  System.arraycopy(in,inOff,padded,0,len);
  padded[len]=(byte)0x80;
  intToBytes(len * BITS_IN_BYTE,padded,padded.length - 12);
  return padded;
}

Fixed version (ground truth):
private byte[] padKey(byte[] in,int inOff,int len){
  byte[] padded;
  if (len % engine.getByteLength() == 0) {
    padded=new byte[len + engine.getByteLength()];
  }
 else {
    int blocks=len / engine.getByteLength();
    padded=new byte[(blocks * engine.getByteLength()) + engine.getByteLength()];
  }
  System.arraycopy(in,inOff,padded,0,len);
  padded[len]=(byte)0x80;
  Pack.intToLittleEndian(len * BITS_IN_BYTE,padded,padded.length - 12);
  return padded;
}
Program: 52408
Project: 52408
Buggy source:
@Override public void performTest(){
  TestResult result;
  result=hash256Tests();
  if (!result.isSuccessful()) {
    System.out.println(result);
    return;
  }
  result=hash384Tests();
  if (!result.isSuccessful()) {
    System.out.println(result);
    return;
  }
  result=hash512Tests();
  if (!result.isSuccessful()) {
    System.out.println(result);
    return;
  }
  result=macTests();
  if (!result.isSuccessful()) {
    System.out.println(result);
    return;
  }
  System.out.println(result);
}

Fixed version (ground truth):
@Override public void performTest(){
  TestResult result;
  result=hash256Tests();
  if (!result.isSuccessful()) {
    System.out.println(result);
    return;
  }
  result=hash384Tests();
  if (!result.isSuccessful()) {
    System.out.println(result);
    return;
  }
  result=hash512Tests();
  if (!result.isSuccessful()) {
    System.out.println(result);
    return;
  }
  result=macTests();
  if (!result.isSuccessful()) {
    System.out.println(result);
    return;
  }
  result=overflowTest();
  if (!result.isSuccessful()) {
    System.out.println(result);
    return;
  }
  System.out.println(result);
}
Program: 52409
Project: 52409
Buggy source:
public void reset(){
  for (int bufferIndex=0; bufferIndex < state.length; bufferIndex++) {
    state[bufferIndex]=new byte[columns];
  }
  state[0][0]=(byte)state.length;
  inputLength=0;
  bufOff=0;
  Arrays.fill(buf,(byte)0);
  Arrays.fill(padded,(byte)0);
}

Fixed version (ground truth):
public void reset(Memoable other){
  DSTU7564Digest d=(DSTU7564Digest)other;
  copyIn(d);
}
Program: 52410
Project: 52410
Buggy source:
public void init(CipherParameters params) throws IllegalArgumentException {
  if (params instanceof KeyParameter) {
    byte[] key=((KeyParameter)params).getKey();
    invertedKey=new byte[key.length];
    paddedKey=padKey(key,0,key.length);
    for (int byteIndex=0; byteIndex < invertedKey.length; byteIndex++) {
      invertedKey[byteIndex]=(byte)(key[byteIndex] ^ (byte)0xFF);
    }
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  engine.update(paddedKey,0,paddedKey.length);
}

Fixed version (ground truth):
public void init(CipherParameters params) throws IllegalArgumentException {
  if (params instanceof KeyParameter) {
    byte[] key=((KeyParameter)params).getKey();
    invertedKey=new byte[key.length];
    paddedKey=padKey(key);
    for (int byteIndex=0; byteIndex < invertedKey.length; byteIndex++) {
      invertedKey[byteIndex]=(byte)(key[byteIndex] ^ (byte)0xFF);
    }
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  engine.update(paddedKey,0,paddedKey.length);
}
Program: 52411
Project: 52411
Buggy source:
private void pad(){
  int extra=engine.getByteLength() - (int)(inputLength % engine.getByteLength());
  if (extra < 13) {
    extra=engine.getByteLength();
  }
  byte[] padded=new byte[extra];
  padded[0]=(byte)0x80;
  Pack.longToLittleEndian(inputLength * BITS_IN_BYTE,padded,padded.length - 12);
  engine.update(padded,0,padded.length);
}

Fixed version (ground truth):
private void pad(){
  int extra=engine.getByteLength() - (int)(inputLength % engine.getByteLength());
  if (extra < 13) {
    extra+=engine.getByteLength();
  }
  byte[] padded=new byte[extra];
  padded[0]=(byte)0x80;
  Pack.longToLittleEndian(inputLength * BITS_IN_BYTE,padded,padded.length - 12);
  engine.update(padded,0,padded.length);
}
Program: 52412
Project: 52412
Buggy source:
private byte[] padKey(byte[] in,int inOff,int len){
  byte[] padded;
  if (len % engine.getByteLength() == 0) {
    padded=new byte[len + engine.getByteLength()];
  }
 else {
    int blocks=len / engine.getByteLength();
    padded=new byte[(blocks * engine.getByteLength()) + engine.getByteLength()];
  }
  System.arraycopy(in,inOff,padded,0,len);
  padded[len]=(byte)0x80;
  Pack.intToLittleEndian(len * BITS_IN_BYTE,padded,padded.length - 12);
  return padded;
}

Fixed version (ground truth):
private byte[] padKey(byte[] in){
  int paddedLen=((in.length + engine.getByteLength() - 1) / engine.getByteLength()) * engine.getByteLength();
  int extra=engine.getByteLength() - (int)(in.length % engine.getByteLength());
  if (extra < 13) {
    paddedLen+=engine.getByteLength();
  }
  byte[] padded=new byte[paddedLen];
  System.arraycopy(in,0,padded,0,in.length);
  padded[in.length]=(byte)0x80;
  Pack.intToLittleEndian(in.length * BITS_IN_BYTE,padded,padded.length - 12);
  return padded;
}
Program: 52413
Project: 52413
Buggy source:
protected Digest cloneDigest(Digest digest){
  return null;
}

Fixed version (ground truth):
protected Digest cloneDigest(Digest digest){
  return new DSTU7564Digest((DSTU7564Digest)digest);
}
Program: 52414
Project: 52414
Buggy source:
public DSTU7564Test(){
  super(new DSTU7564Digest(256),new String[0],new String[0]);
}

Fixed version (ground truth):
public DSTU7564Test(){
  super(new DSTU7564Digest(256),messages,digests);
}
Program: 52416
Project: 52416
Buggy source:
@Override public void performTest(){
  hash256Tests();
  hash384Tests();
  hash512Tests();
  macTests();
  overflowTest();
}

Fixed version (ground truth):
@Override public void performTest(){
  super.performTest();
  overflowTest();
}
Program: 52418
Project: 52418
Buggy source:
public void performTest() throws Exception {
  signTest();
}

Fixed version (ground truth):
public void performTest() throws Exception {
  alltest();
}
Program: 52420
Project: 52420
Buggy source:
public PKIData(ASN1Sequence seq){
  if (seq.size() != 4) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ASN1Sequence s=((ASN1Sequence)seq.getObjectAt(0));
  controlSequence=new TaggedAttribute[s.size()];
  for (int t=0; t < controlSequence.length; t++) {
    controlSequence[t]=TaggedAttribute.getInstance(s.getObjectAt(t));
  }
  s=((ASN1Sequence)seq.getObjectAt(1));
  reqSequence=new TaggedRequest[s.size()];
  for (int t=0; t < controlSequence.length; t++) {
    reqSequence[t]=TaggedRequest.getInstance(s.getObjectAt(t));
  }
  s=((ASN1Sequence)seq.getObjectAt(2));
  cmsSequence=new TaggedContentInfo[s.size()];
  for (int t=0; t < cmsSequence.length; t++) {
    cmsSequence[t]=TaggedContentInfo.getInstance(s.getObjectAt(t));
  }
  s=((ASN1Sequence)seq.getObjectAt(3));
  otherMsgSequence=new OtherMsg[s.size()];
  for (int t=0; t < cmsSequence.length; t++) {
    otherMsgSequence[t]=OtherMsg.getInstance(s.getObjectAt(t));
  }
}

Fixed version (ground truth):
private PKIData(ASN1Sequence seq){
  if (seq.size() != 4) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ASN1Sequence s=((ASN1Sequence)seq.getObjectAt(0));
  controlSequence=new TaggedAttribute[s.size()];
  for (int t=0; t < controlSequence.length; t++) {
    controlSequence[t]=TaggedAttribute.getInstance(s.getObjectAt(t));
  }
  s=((ASN1Sequence)seq.getObjectAt(1));
  reqSequence=new TaggedRequest[s.size()];
  for (int t=0; t < reqSequence.length; t++) {
    reqSequence[t]=TaggedRequest.getInstance(s.getObjectAt(t));
  }
  s=((ASN1Sequence)seq.getObjectAt(2));
  cmsSequence=new TaggedContentInfo[s.size()];
  for (int t=0; t < cmsSequence.length; t++) {
    cmsSequence[t]=TaggedContentInfo.getInstance(s.getObjectAt(t));
  }
  s=((ASN1Sequence)seq.getObjectAt(3));
  otherMsgSequence=new OtherMsg[s.size()];
  for (int t=0; t < otherMsgSequence.length; t++) {
    otherMsgSequence[t]=OtherMsg.getInstance(s.getObjectAt(t));
  }
}
Program: 52421
Project: 52421
Buggy source:
@Override public Object clone(){
  Headers n=new Headers();
  for (  Entry<String,String[]> v : entrySet()) {
    n.put(v.getKey(),v.getValue());
  }
  return n;
}

Fixed version (ground truth):
@Override public Object clone(){
  Headers n=new Headers();
  for (  Map.Entry<String,String[]> v : entrySet()) {
    n.put(v.getKey(),v.getValue());
  }
  return n;
}
Program: 52423
Project: 52423
Buggy source:
NonceEntropySource(JcaJceHelper helper,SecureRandom random) throws GeneralSecurityException {
  super(new NonceEntropySourceSpi(random,helper.createDigest("String_Node_Str")),null);
}

Fixed version (ground truth):
NonceEntropySource(JcaJceHelper helper,SecureRandom random) throws GeneralSecurityException {
  super(new NonceEntropySourceSpi(random,helper.createDigest("String_Node_Str")),random.getProvider());
}
Program: 52424
Project: 52424
Buggy source:
public static SignatureAndHashAlgorithm chooseSignatureAndHashAlgorithm(TlsContext context,Vector algs,int signatureAlgorithm) throws IOException {
  if (!TlsUtils.isTLSv12(context)) {
    return null;
  }
  if (algs == null) {
    algs=TlsUtils.getDefaultSignatureAlgorithms(signatureAlgorithm);
  }
  SignatureAndHashAlgorithm result=null;
  for (int i=0; i < algs.size(); ++i) {
    SignatureAndHashAlgorithm alg=(SignatureAndHashAlgorithm)algs.elementAt(i);
    if (alg.getSignature() == signatureAlgorithm) {
      short hash=alg.getHash();
      if (hash < MINIMUM_HASH_STRICT) {
        continue;
      }
      if (result == null) {
        result=alg;
        continue;
      }
      short current=result.getHash();
      if (hash < MINIMUM_HASH_PREFERRED) {
        if (hash > current) {
          result=alg;
        }
      }
 else {
        if (hash < current) {
          result=alg;
        }
      }
    }
  }
  if (result == null) {
    throw new TlsFatalAlert(AlertDescription.internal_error);
  }
  return result;
}

Fixed version (ground truth):
public static SignatureAndHashAlgorithm chooseSignatureAndHashAlgorithm(TlsContext context,Vector algs,int signatureAlgorithm) throws IOException {
  if (!TlsUtils.isTLSv12(context)) {
    return null;
  }
  if (algs == null) {
    algs=TlsUtils.getDefaultSignatureAlgorithms(signatureAlgorithm);
  }
  SignatureAndHashAlgorithm result=null;
  for (int i=0; i < algs.size(); ++i) {
    SignatureAndHashAlgorithm alg=(SignatureAndHashAlgorithm)algs.elementAt(i);
    if (alg.getSignature() == signatureAlgorithm) {
      short hash=alg.getHash();
      if (hash < MINIMUM_HASH_STRICT) {
        continue;
      }
      if (result == null) {
        result=alg;
        continue;
      }
      short current=result.getHash();
      if (current < MINIMUM_HASH_PREFERRED) {
        if (hash > current) {
          result=alg;
        }
      }
 else {
        if (hash < current) {
          result=alg;
        }
      }
    }
  }
  if (result == null) {
    throw new TlsFatalAlert(AlertDescription.internal_error);
  }
  return result;
}
Program: 52425
Project: 52425
Buggy source:
/** 
 * Construct a DVCS Request from a ContentInfo
 * @param contentInfo the contentInfo representing the DVCSRequest
 * @throws org.bouncycastle.dvcs.DVCSConstructionException
 */
public DVCSResponse(ContentInfo contentInfo) throws DVCSConstructionException {
  super(contentInfo);
  if (!DVCSObjectIdentifiers.id_ct_DVCSResponseData.equals(contentInfo.getContentType())) {
    throw new DVCSConstructionException("String_Node_Str");
  }
  try {
    if (contentInfo.getContent().toASN1Primitive() instanceof ASN1Sequence) {
      this.asn1=org.bouncycastle.asn1.dvcs.DVCSResponse.getInstance(contentInfo.getContent());
    }
 else {
      this.asn1=org.bouncycastle.asn1.dvcs.DVCSResponse.getInstance(ASN1OctetString.getInstance(contentInfo.getContent()).getOctets());
    }
  }
 catch (  Exception e) {
    throw new DVCSConstructionException("String_Node_Str" + e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Construct a DVCS Response from a ContentInfo
 * @param contentInfo the contentInfo representing the DVCSRequest
 * @throws org.bouncycastle.dvcs.DVCSConstructionException
 */
public DVCSResponse(ContentInfo contentInfo) throws DVCSConstructionException {
  super(contentInfo);
  if (!DVCSObjectIdentifiers.id_ct_DVCSResponseData.equals(contentInfo.getContentType())) {
    throw new DVCSConstructionException("String_Node_Str");
  }
  try {
    if (contentInfo.getContent().toASN1Primitive() instanceof ASN1Sequence) {
      this.asn1=org.bouncycastle.asn1.dvcs.DVCSResponse.getInstance(contentInfo.getContent());
    }
 else {
      this.asn1=org.bouncycastle.asn1.dvcs.DVCSResponse.getInstance(ASN1OctetString.getInstance(contentInfo.getContent()).getOctets());
    }
  }
 catch (  Exception e) {
    throw new DVCSConstructionException("String_Node_Str" + e.getMessage(),e);
  }
}
Program: 52426
Project: 52426
Buggy source:
public static void square(int[] x,int xOff,int[] zz,int zzOff){
  long x_0=x[xOff + 0] & M;
  long zz_1;
  int c=0, w;
{
    int i=3, j=8;
    do {
      long xVal=(x[xOff + i--] & M);
      long p=xVal * xVal;
      zz[zzOff + --j]=(c << 31) | (int)(p >>> 33);
      zz[zzOff + --j]=(int)(p >>> 1);
      c=(int)p;
    }
 while (i > 0);
{
      long p=x_0 * x_0;
      zz_1=((c << 31) & M) | (p >>> 33);
      zz[zzOff + 0]=(int)p;
      c=(int)(p >>> 32) & 1;
    }
  }
  long x_1=x[xOff + 1] & M;
  long zz_2=zz[zzOff + 2] & M;
{
    zz_1+=x_1 * x_0;
    w=(int)zz_1;
    zz[zzOff + 1]=(w << 1) | c;
    c=w >>> 31;
    zz_2+=zz_1 >>> 32;
  }
  long x_2=x[xOff + 2] & M;
  long zz_3=zz[zzOff + 3] & M;
  long zz_4=zz[zzOff + 4] & M;
{
    zz_2+=x_2 * x_0;
    w=(int)zz_2;
    zz[zzOff + 2]=(w << 1) | c;
    c=w >>> 31;
    zz_3+=(zz_2 >>> 32) + x_2 * x_1;
    zz_4+=zz_3 >>> 32;
    zz_3&=M;
  }
  long x_3=x[xOff + 3] & M;
  long zz_5=zz[zzOff + 5] & M;
  long zz_6=zz[zzOff + 6] & M;
{
    zz_3+=x_3 * x_0;
    w=(int)zz_3;
    zz[zzOff + 3]=(w << 1) | c;
    c=w >>> 31;
    zz_4+=(zz_3 >>> 32) + x_3 * x_1;
    zz_5+=(zz_4 >>> 32) + x_3 * x_2;
    zz_6+=zz_5 >>> 32;
  }
  w=(int)zz_4;
  zz[zzOff + 4]=(w << 1) | c;
  c=w >>> 31;
  w=(int)zz_5;
  zz[zzOff + 5]=(w << 1) | c;
  c=w >>> 31;
  w=(int)zz_6;
  zz[zzOff + 6]=(w << 1) | c;
  c=w >>> 31;
  w=zz[zzOff + 7] + (int)(zz_6 >> 32);
  zz[zzOff + 7]=(w << 1) | c;
}

Fixed version (ground truth):
public static void square(int[] x,int xOff,int[] zz,int zzOff){
  long x_0=x[xOff + 0] & M;
  long zz_1;
  int c=0, w;
{
    int i=3, j=8;
    do {
      long xVal=(x[xOff + i--] & M);
      long p=xVal * xVal;
      zz[zzOff + --j]=(c << 31) | (int)(p >>> 33);
      zz[zzOff + --j]=(int)(p >>> 1);
      c=(int)p;
    }
 while (i > 0);
{
      long p=x_0 * x_0;
      zz_1=((c << 31) & M) | (p >>> 33);
      zz[zzOff + 0]=(int)p;
      c=(int)(p >>> 32) & 1;
    }
  }
  long x_1=x[xOff + 1] & M;
  long zz_2=zz[zzOff + 2] & M;
{
    zz_1+=x_1 * x_0;
    w=(int)zz_1;
    zz[zzOff + 1]=(w << 1) | c;
    c=w >>> 31;
    zz_2+=zz_1 >>> 32;
  }
  long x_2=x[xOff + 2] & M;
  long zz_3=zz[zzOff + 3] & M;
  long zz_4=zz[zzOff + 4] & M;
{
    zz_2+=x_2 * x_0;
    w=(int)zz_2;
    zz[zzOff + 2]=(w << 1) | c;
    c=w >>> 31;
    zz_3+=(zz_2 >>> 32) + x_2 * x_1;
    zz_4+=zz_3 >>> 32;
    zz_3&=M;
  }
  long x_3=x[xOff + 3] & M;
  long zz_5=(zz[zzOff + 5] & M) + (zz_4 >>> 32);
  zz_4&=M;
  long zz_6=(zz[zzOff + 6] & M) + (zz_5 >>> 32);
  zz_5&=M;
{
    zz_3+=x_3 * x_0;
    w=(int)zz_3;
    zz[zzOff + 3]=(w << 1) | c;
    c=w >>> 31;
    zz_4+=(zz_3 >>> 32) + x_3 * x_1;
    zz_5+=(zz_4 >>> 32) + x_3 * x_2;
    zz_6+=zz_5 >>> 32;
  }
  w=(int)zz_4;
  zz[zzOff + 4]=(w << 1) | c;
  c=w >>> 31;
  w=(int)zz_5;
  zz[zzOff + 5]=(w << 1) | c;
  c=w >>> 31;
  w=(int)zz_6;
  zz[zzOff + 6]=(w << 1) | c;
  c=w >>> 31;
  w=zz[zzOff + 7] + (int)(zz_6 >>> 32);
  zz[zzOff + 7]=(w << 1) | c;
}
Program: 52430
Project: 52430
Buggy source:
/** 
 * Remove a certification from the key.
 * @param key the key the certifications are to be removed from.
 * @param certification the certification to be removed.
 * @return the modified key, null if the certification was not found.
 */
public static PGPPublicKey removeCertification(PGPPublicKey key,PGPSignature certification){
  PGPPublicKey returnKey=new PGPPublicKey(key);
  boolean found;
  if (returnKey.subSigs != null) {
    found=returnKey.subSigs.remove(certification);
  }
 else {
    found=returnKey.keySigs.remove(certification);
  }
  if (!found) {
    for (Iterator it=key.getUserIDs(); it.hasNext(); ) {
      String id=(String)it.next();
      for (Iterator sIt=key.getSignaturesForID(id); sIt.hasNext(); ) {
        if (certification == sIt.next()) {
          found=true;
          returnKey=PGPPublicKey.removeCertification(returnKey,id,certification);
        }
      }
    }
    if (!found) {
      for (Iterator it=key.getUserAttributes(); it.hasNext(); ) {
        PGPUserAttributeSubpacketVector id=(PGPUserAttributeSubpacketVector)it.next();
        for (Iterator sIt=key.getSignaturesForUserAttribute(id); sIt.hasNext(); ) {
          if (certification == sIt.next()) {
            found=true;
            returnKey=PGPPublicKey.removeCertification(returnKey,id,certification);
          }
        }
      }
    }
  }
  return returnKey;
}

Fixed version (ground truth):
/** 
 * Remove a certification from the key.
 * @param key the key the certifications are to be removed from.
 * @param certification the certification to be removed.
 * @return the modified key, null if the certification was not found.
 */
public static PGPPublicKey removeCertification(PGPPublicKey key,PGPSignature certification){
  PGPPublicKey returnKey=new PGPPublicKey(key);
  boolean found;
  if (returnKey.subSigs != null) {
    found=returnKey.subSigs.remove(certification);
  }
 else {
    found=returnKey.keySigs.remove(certification);
  }
  if (!found) {
    for (Iterator it=key.getRawUserIDs(); it.hasNext(); ) {
      UserIDPacket id=(UserIDPacket)it.next();
      for (Iterator sIt=key.getSignaturesForID(id); sIt.hasNext(); ) {
        if (certification == sIt.next()) {
          found=true;
          returnKey=PGPPublicKey.removeCertification(returnKey,id,certification);
        }
      }
    }
    if (!found) {
      for (Iterator it=key.getUserAttributes(); it.hasNext(); ) {
        PGPUserAttributeSubpacketVector id=(PGPUserAttributeSubpacketVector)it.next();
        for (Iterator sIt=key.getSignaturesForUserAttribute(id); sIt.hasNext(); ) {
          if (certification == sIt.next()) {
            found=true;
            returnKey=PGPPublicKey.removeCertification(returnKey,id,certification);
          }
        }
      }
    }
  }
  return returnKey;
}
Program: 52431
Project: 52431
Buggy source:
/** 
 * Remove a certification from the key.
 * @param key the key the certifications are to be removed from.
 * @param certification the certification to be removed.
 * @return the modified key, null if the certification was not found.
 */
public static PGPPublicKey removeCertification(PGPPublicKey key,PGPSignature certification){
  PGPPublicKey returnKey=new PGPPublicKey(key);
  boolean found;
  if (returnKey.subSigs != null) {
    found=returnKey.subSigs.remove(certification);
  }
 else {
    found=returnKey.keySigs.remove(certification);
  }
  if (!found) {
    for (Iterator it=key.getUserIDs(); it.hasNext(); ) {
      UserIDPacket id=(UserIDPacket)it.next();
      for (Iterator sIt=key.getSignaturesForID(id); sIt.hasNext(); ) {
        if (certification == sIt.next()) {
          found=true;
          returnKey=PGPPublicKey.removeCertification(returnKey,id.getRawID(),certification);
        }
      }
    }
    if (!found) {
      for (Iterator it=key.getUserAttributes(); it.hasNext(); ) {
        PGPUserAttributeSubpacketVector id=(PGPUserAttributeSubpacketVector)it.next();
        for (Iterator sIt=key.getSignaturesForUserAttribute(id); sIt.hasNext(); ) {
          if (certification == sIt.next()) {
            found=true;
            returnKey=PGPPublicKey.removeCertification(returnKey,id,certification);
          }
        }
      }
    }
  }
  return returnKey;
}

Fixed version (ground truth):
/** 
 * Remove a certification from the key.
 * @param key the key the certifications are to be removed from.
 * @param certification the certification to be removed.
 * @return the modified key, null if the certification was not found.
 */
public static PGPPublicKey removeCertification(PGPPublicKey key,PGPSignature certification){
  PGPPublicKey returnKey=new PGPPublicKey(key);
  boolean found;
  if (returnKey.subSigs != null) {
    found=returnKey.subSigs.remove(certification);
  }
 else {
    found=returnKey.keySigs.remove(certification);
  }
  if (!found) {
    for (Iterator it=key.getRawUserIDs(); it.hasNext(); ) {
      UserIDPacket id=(UserIDPacket)it.next();
      for (Iterator sIt=key.getSignaturesForID(id); sIt.hasNext(); ) {
        if (certification == sIt.next()) {
          found=true;
          returnKey=PGPPublicKey.removeCertification(returnKey,id.getRawID(),certification);
        }
      }
    }
    if (!found) {
      for (Iterator it=key.getUserAttributes(); it.hasNext(); ) {
        PGPUserAttributeSubpacketVector id=(PGPUserAttributeSubpacketVector)it.next();
        for (Iterator sIt=key.getSignaturesForUserAttribute(id); sIt.hasNext(); ) {
          if (certification == sIt.next()) {
            found=true;
            returnKey=PGPPublicKey.removeCertification(returnKey,id,certification);
          }
        }
      }
    }
  }
  return returnKey;
}
Program: 52432
Project: 52432
Buggy source:
public void testRSAServer() throws Exception {
  KeyStore ks=getRsaKeyStore(false);
  KeyStore trustStore=KeyStore.getInstance("String_Node_Str");
  trustStore.load(null,PASSWORD);
  trustStore.setCertificateEntry("String_Node_Str",ks.getCertificate("String_Node_Str"));
  SSLUtils.startServer(ks,PASSWORD,trustStore);
  TrustManagerFactory trustManagerFactory=TrustManagerFactory.getInstance("String_Node_Str",BouncyCastleJsseProvider.PROVIDER_NAME);
  trustManagerFactory.init(trustStore);
  SSLContext context=SSLContext.getInstance("String_Node_Str");
  context.init(null,trustManagerFactory.getTrustManagers(),null);
  SSLSocketFactory f=context.getSocketFactory();
  SSLSocket c=(SSLSocket)f.createSocket("String_Node_Str",8888);
  c.setUseClientMode(true);
  c.startHandshake();
  c.getOutputStream().write('!');
  c.getInputStream().read();
}

Fixed version (ground truth):
public void testRSAServer() throws Exception {
  KeyStore ks=getRsaKeyStore(false);
  KeyStore trustStore=KeyStore.getInstance("String_Node_Str");
  trustStore.load(null,PASSWORD);
  trustStore.setCertificateEntry("String_Node_Str",ks.getCertificate("String_Node_Str"));
  SSLUtils.startServer(ks,PASSWORD,trustStore,false,8886);
  TrustManagerFactory trustManagerFactory=TrustManagerFactory.getInstance("String_Node_Str",BouncyCastleJsseProvider.PROVIDER_NAME);
  trustManagerFactory.init(trustStore);
  SSLContext context=SSLContext.getInstance("String_Node_Str");
  context.init(null,trustManagerFactory.getTrustManagers(),null);
  SSLSocketFactory f=context.getSocketFactory();
  SSLSocket c=(SSLSocket)f.createSocket("String_Node_Str",8886);
  c.setUseClientMode(true);
  c.startHandshake();
  c.getOutputStream().write('!');
  c.getInputStream().read();
}
Program: 52433
Project: 52433
Buggy source:
public void testRSAServerWithClientAuth() throws Exception {
  KeyStore ks=getRsaKeyStore(false);
  KeyStore trustStore=KeyStore.getInstance("String_Node_Str");
  trustStore.load(null,PASSWORD);
  trustStore.setCertificateEntry("String_Node_Str",ks.getCertificate("String_Node_Str"));
  SSLUtils.startServer(ks,PASSWORD,trustStore,true);
  KeyManagerFactory keyManagerFactory=KeyManagerFactory.getInstance("String_Node_Str",BouncyCastleJsseProvider.PROVIDER_NAME);
  keyManagerFactory.init(ks,PASSWORD);
  TrustManagerFactory trustManagerFactory=TrustManagerFactory.getInstance("String_Node_Str",BouncyCastleJsseProvider.PROVIDER_NAME);
  trustManagerFactory.init(trustStore);
  SSLContext context=SSLContext.getInstance("String_Node_Str");
  context.init(keyManagerFactory.getKeyManagers(),trustManagerFactory.getTrustManagers(),null);
  SSLSocketFactory f=context.getSocketFactory();
  SSLSocket c=(SSLSocket)f.createSocket("String_Node_Str",8888);
  c.setUseClientMode(true);
  SSLUtils.restrictKeyExchange(c,"String_Node_Str");
  c.startHandshake();
  c.getOutputStream().write('!');
  c.getInputStream().read();
}

Fixed version (ground truth):
public void testRSAServerWithClientAuth() throws Exception {
  KeyStore ks=getRsaKeyStore(false);
  KeyStore trustStore=KeyStore.getInstance("String_Node_Str");
  trustStore.load(null,PASSWORD);
  trustStore.setCertificateEntry("String_Node_Str",ks.getCertificate("String_Node_Str"));
  SSLUtils.startServer(ks,PASSWORD,trustStore,true,8887);
  KeyManagerFactory keyManagerFactory=KeyManagerFactory.getInstance("String_Node_Str",BouncyCastleJsseProvider.PROVIDER_NAME);
  keyManagerFactory.init(ks,PASSWORD);
  TrustManagerFactory trustManagerFactory=TrustManagerFactory.getInstance("String_Node_Str",BouncyCastleJsseProvider.PROVIDER_NAME);
  trustManagerFactory.init(trustStore);
  SSLContext context=SSLContext.getInstance("String_Node_Str");
  context.init(keyManagerFactory.getKeyManagers(),trustManagerFactory.getTrustManagers(),null);
  SSLSocketFactory f=context.getSocketFactory();
  SSLSocket c=(SSLSocket)f.createSocket("String_Node_Str",8887);
  c.setUseClientMode(true);
  SSLUtils.restrictKeyExchange(c,"String_Node_Str");
  c.startHandshake();
  c.getOutputStream().write('!');
  c.getInputStream().read();
}
Program: 52434
Project: 52434
Buggy source:
static void startServer(final KeyStore keyStore,final char[] password,final KeyStore serverStore,final boolean needClientAuth){
  Runnable serverTask=new Runnable(){
    public void run(){
      try {
        KeyManagerFactory keyManagerFactory=KeyManagerFactory.getInstance("String_Node_Str");
        keyManagerFactory.init(keyStore,password);
        TrustManagerFactory trustManagerFactory=TrustManagerFactory.getInstance("String_Node_Str");
        trustManagerFactory.init(serverStore);
        SSLContext context=SSLContext.getInstance("String_Node_Str");
        context.init(keyManagerFactory.getKeyManagers(),trustManagerFactory.getTrustManagers(),null);
        SSLServerSocketFactory sslSocketFactory=context.getServerSocketFactory();
        SSLServerSocket ss=(SSLServerSocket)sslSocketFactory.createServerSocket(8888);
        ss.setNeedClientAuth(needClientAuth);
        SSLSocket s=(SSLSocket)ss.accept();
        s.setUseClientMode(false);
        s.startHandshake();
        s.getInputStream().read();
        s.getOutputStream().write('!');
        s.close();
        ss.close();
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
;
  new Thread(serverTask).start();
}

Fixed version (ground truth):
static void startServer(final KeyStore keyStore,final char[] password,final KeyStore serverStore,final boolean needClientAuth,final int port){
  final CountDownLatch latch=new CountDownLatch(1);
  Runnable serverTask=new Runnable(){
    public void run(){
      try {
        KeyManagerFactory keyManagerFactory=KeyManagerFactory.getInstance("String_Node_Str");
        keyManagerFactory.init(keyStore,password);
        TrustManagerFactory trustManagerFactory=TrustManagerFactory.getInstance("String_Node_Str");
        trustManagerFactory.init(serverStore);
        SSLContext context=SSLContext.getInstance("String_Node_Str");
        context.init(keyManagerFactory.getKeyManagers(),trustManagerFactory.getTrustManagers(),null);
        SSLServerSocketFactory sslSocketFactory=context.getServerSocketFactory();
        SSLServerSocket ss=(SSLServerSocket)sslSocketFactory.createServerSocket(port);
        ss.setNeedClientAuth(needClientAuth);
        latch.countDown();
        SSLSocket s=(SSLSocket)ss.accept();
        s.setUseClientMode(false);
        s.startHandshake();
        s.getInputStream().read();
        s.getOutputStream().write('!');
        s.close();
        ss.close();
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
;
  new Thread(serverTask).start();
  try {
    latch.await();
  }
 catch (  InterruptedException e) {
  }
}
Program: 52435
Project: 52435
Buggy source:
public void run(){
  try {
    KeyManagerFactory keyManagerFactory=KeyManagerFactory.getInstance("String_Node_Str");
    keyManagerFactory.init(keyStore,password);
    TrustManagerFactory trustManagerFactory=TrustManagerFactory.getInstance("String_Node_Str");
    trustManagerFactory.init(serverStore);
    SSLContext context=SSLContext.getInstance("String_Node_Str");
    context.init(keyManagerFactory.getKeyManagers(),trustManagerFactory.getTrustManagers(),null);
    SSLServerSocketFactory sslSocketFactory=context.getServerSocketFactory();
    SSLServerSocket ss=(SSLServerSocket)sslSocketFactory.createServerSocket(8888);
    ss.setNeedClientAuth(needClientAuth);
    SSLSocket s=(SSLSocket)ss.accept();
    s.setUseClientMode(false);
    s.startHandshake();
    s.getInputStream().read();
    s.getOutputStream().write('!');
    s.close();
    ss.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void run(){
  try {
    KeyManagerFactory keyManagerFactory=KeyManagerFactory.getInstance("String_Node_Str");
    keyManagerFactory.init(keyStore,password);
    TrustManagerFactory trustManagerFactory=TrustManagerFactory.getInstance("String_Node_Str");
    trustManagerFactory.init(serverStore);
    SSLContext context=SSLContext.getInstance("String_Node_Str");
    context.init(keyManagerFactory.getKeyManagers(),trustManagerFactory.getTrustManagers(),null);
    SSLServerSocketFactory sslSocketFactory=context.getServerSocketFactory();
    SSLServerSocket ss=(SSLServerSocket)sslSocketFactory.createServerSocket(port);
    ss.setNeedClientAuth(needClientAuth);
    latch.countDown();
    SSLSocket s=(SSLSocket)ss.accept();
    s.setUseClientMode(false);
    s.startHandshake();
    s.getInputStream().read();
    s.getOutputStream().write('!');
    s.close();
    ss.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 52437
Project: 52437
Buggy source:
public void init(boolean forEncryption,CipherParameters param){
  AsymmetricKeyParameter kParam;
  if (param instanceof ParametersWithRandom) {
    ParametersWithRandom rParam=(ParametersWithRandom)param;
    this.random=rParam.getRandom();
    kParam=(AsymmetricKeyParameter)rParam.getParameters();
  }
 else {
    kParam=(AsymmetricKeyParameter)param;
    if (!kParam.isPrivate() && forEncryption) {
      this.random=new SecureRandom();
    }
  }
  engine.init(forEncryption,param);
  this.forPrivateKey=kParam.isPrivate();
  this.forEncryption=forEncryption;
  this.blockBuffer=new byte[engine.getOutputBlockSize()];
}

Fixed version (ground truth):
public void init(boolean forEncryption,CipherParameters param){
  AsymmetricKeyParameter kParam;
  if (param instanceof ParametersWithRandom) {
    ParametersWithRandom rParam=(ParametersWithRandom)param;
    this.random=rParam.getRandom();
    kParam=(AsymmetricKeyParameter)rParam.getParameters();
  }
 else {
    kParam=(AsymmetricKeyParameter)param;
    if (!kParam.isPrivate() && forEncryption) {
      this.random=new SecureRandom();
    }
  }
  engine.init(forEncryption,param);
  this.forPrivateKey=kParam.isPrivate();
  this.forEncryption=forEncryption;
  this.blockBuffer=new byte[engine.getOutputBlockSize()];
  if (pLen > 0 && fallback == null && random == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}