Program: 117095
Project: 117095
Buggy source:
/** 
 * Similar to   {@link #encodeBytes(byte[],int,int,int)} but returnsa byte array instead of instantiating a String. This is more efficient if you're working with I/O streams and have large data sets to encode.
 * @param source The data to convert
 * @param off Offset in array where conversion should begin
 * @param len Length of data to convert
 * @param options Specified options
 * @return The Base64-encoded data as a String
 * @see Base64#GZIP
 * @see Base64#DO_BREAK_LINES
 * @throws java.io.IOException if there is an error
 * @throws NullPointerException if source array is null
 * @throws IllegalArgumentException if source array, offset, or length are invalid
 * @since 2.3.1
 */
public static byte[] encodeBytesToBytes(byte[] source,int off,int len,int options) throws java.io.IOException {
  if (source == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (off < 0) {
    throw new IllegalArgumentException("String_Node_Str" + off);
  }
  if (len < 0) {
    throw new IllegalArgumentException("String_Node_Str" + len);
  }
  if (off + len > source.length) {
    throw new IllegalArgumentException(String.format("String_Node_Str",off,len,source.length));
  }
  if ((options & GZIP) > 0) {
    java.io.ByteArrayOutputStream baos=null;
    java.util.zip.GZIPOutputStream gzos=null;
    Base64.OutputStream b64os=null;
    try {
      baos=new java.io.ByteArrayOutputStream();
      b64os=new Base64.OutputStream(baos,ENCODE | options);
      gzos=new java.util.zip.GZIPOutputStream(b64os);
      gzos.write(source,off,len);
      gzos.close();
    }
 catch (    java.io.IOException e) {
      throw e;
    }
 finally {
      try {
        gzos.close();
      }
 catch (      Exception e) {
      }
      try {
        b64os.close();
      }
 catch (      Exception e) {
      }
      try {
        baos.close();
      }
 catch (      Exception e) {
      }
    }
    return baos.toByteArray();
  }
 else {
    boolean breakLines=(options & DO_BREAK_LINES) > 0;
    int encLen=(len / 3) * 4 + (len % 3 > 0 ? 4 : 0);
    if (breakLines) {
      encLen+=encLen / MAX_LINE_LENGTH;
    }
    byte[] outBuff=new byte[encLen];
    int d=0;
    int e=0;
    int len2=len - 2;
    int lineLength=0;
    for (; d < len2; d+=3, e+=4) {
      encode3to4(source,d + off,3,outBuff,e,options);
      lineLength+=4;
      if (breakLines && lineLength >= MAX_LINE_LENGTH) {
        outBuff[e + 4]=NEW_LINE;
        e++;
        lineLength=0;
      }
    }
    if (d < len) {
      encode3to4(source,d + off,len - d,outBuff,e,options);
      e+=4;
    }
    if (e < outBuff.length - 1) {
      byte[] finalOut=new byte[e];
      System.arraycopy(outBuff,0,finalOut,0,e);
      return finalOut;
    }
 else {
      return outBuff;
    }
  }
}

Fixed version (ground truth):
/** 
 * Similar to   {@link #encodeBytes(byte[],int,int,int)} but returnsa byte array instead of instantiating a String. This is more efficient if you're working with I/O streams and have large data sets to encode.
 * @param source The data to convert
 * @param off Offset in array where conversion should begin
 * @param len Length of data to convert
 * @param options Specified options
 * @return The Base64-encoded data as a String
 * @see Base64#GZIP
 * @see Base64#DO_BREAK_LINES
 * @throws java.io.IOException if there is an error
 * @throws NullPointerException if source array is null
 * @throws IllegalArgumentException if source array, offset, or length are invalid
 * @since 2.3.1
 */
public static byte[] encodeBytesToBytes(byte[] source,int off,int len,int options) throws java.io.IOException {
  if (source == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (off < 0) {
    throw new IllegalArgumentException("String_Node_Str" + off);
  }
  if (len < 0) {
    throw new IllegalArgumentException("String_Node_Str" + len);
  }
  if (off + len > source.length) {
    throw new IllegalArgumentException(String.format("String_Node_Str",off,len,source.length));
  }
  if ((options & GZIP) > 0) {
    java.io.ByteArrayOutputStream baos=null;
    java.util.zip.GZIPOutputStream gzos=null;
    Base64.OutputStream b64os=null;
    try {
      baos=new java.io.ByteArrayOutputStream();
      b64os=new Base64.OutputStream(baos,ENCODE | options);
      gzos=new java.util.zip.GZIPOutputStream(b64os);
      gzos.write(source,off,len);
      gzos.close();
    }
  finally {
      try {
        if (gzos != null) {
          gzos.close();
        }
      }
 catch (      Exception ignored) {
      }
      try {
        if (b64os != null) {
          b64os.close();
        }
      }
 catch (      Exception ignored) {
      }
      try {
        if (baos != null) {
          baos.close();
        }
      }
 catch (      Exception ignored) {
      }
    }
    return baos.toByteArray();
  }
 else {
    boolean breakLines=(options & DO_BREAK_LINES) > 0;
    int encLen=(len / 3) * 4 + (len % 3 > 0 ? 4 : 0);
    if (breakLines) {
      encLen+=encLen / MAX_LINE_LENGTH;
    }
    byte[] outBuff=new byte[encLen];
    int d=0;
    int e=0;
    int len2=len - 2;
    int lineLength=0;
    for (; d < len2; d+=3, e+=4) {
      encode3to4(source,d + off,3,outBuff,e,options);
      lineLength+=4;
      if (breakLines && lineLength >= MAX_LINE_LENGTH) {
        outBuff[e + 4]=NEW_LINE;
        e++;
        lineLength=0;
      }
    }
    if (d < len) {
      encode3to4(source,d + off,len - d,outBuff,e,options);
      e+=4;
    }
    if (e < outBuff.length - 1) {
      byte[] finalOut=new byte[e];
      System.arraycopy(outBuff,0,finalOut,0,e);
      return finalOut;
    }
 else {
      return outBuff;
    }
  }
}