Program: 3161
Project: 3161
Buggy source:
/** 
 * This method executes given CustomOp PLEASE NOTE: You're responsible for input/output validation
 * @param op
 */
public void exec(@NonNull CustomOp op){
  if (op.numOutputArguments() == 0 && !op.isInplaceCall())   throw new ND4JIllegalStateException("String_Node_Str");
  val hash=op.opHash();
  val inputShapes=new PointerPointer<>(op.numInputArguments());
  val inputBuffers=new PointerPointer<>(op.numInputArguments());
  int cnt=0;
  val inputArgs=op.inputArguments();
  for (  val in : inputArgs) {
    inputBuffers.put(cnt,in.data().addressPointer());
    inputShapes.put(cnt++,in.shapeInfoDataBuffer().addressPointer());
  }
  val outputArgs=op.outputArguments();
  for (int i=0; i < outputArgs.length; i++) {
    if (outputArgs[i] == null)     throw new ND4JIllegalStateException("String_Node_Str");
  }
  val outputShapes=new PointerPointer<>(op.numOutputArguments());
  val outputBuffers=new PointerPointer<>(op.numOutputArguments());
  cnt=0;
  for (  val out : outputArgs) {
    outputBuffers.put(cnt,out.data().addressPointer());
    outputShapes.put(cnt++,out.shapeInfoDataBuffer().addressPointer());
  }
  val iArgs=op.numIArguments() > 0 ? new IntPointer(op.numIArguments()) : null;
  cnt=0;
  val iArgs1=op.iArgs();
  for (  val i : iArgs1)   iArgs.put(cnt++,i);
  if (Nd4j.dataType() == DataBuffer.Type.FLOAT) {
    val tArgs=op.numTArguments() > 0 ? new FloatPointer(op.numTArguments()) : null;
    val tArgs1=op.tArgs();
    cnt=0;
    for (    val t : tArgs1)     tArgs.put(cnt++,(float)t);
    val status=OpStatus.byNumber(loop.execCustomOpFloat(null,hash,inputBuffers,inputShapes,op.numInputArguments(),outputBuffers,outputShapes,op.numOutputArguments(),tArgs,op.numTArguments(),iArgs,op.numIArguments(),op.isInplaceCall()));
    if (status != OpStatus.ND4J_STATUS_OK)     throw new ND4JIllegalStateException("String_Node_Str" + status);
  }
 else   if (Nd4j.dataType() == DataBuffer.Type.DOUBLE) {
    val tArgs=op.numTArguments() > 0 ? new DoublePointer(op.numTArguments()) : null;
    val tArgs1=op.tArgs();
    cnt=0;
    for (    val t : tArgs1)     tArgs.put(cnt++,t);
    OpStatus status=OpStatus.ND4J_STATUS_OK;
    try {
      status=OpStatus.byNumber(loop.execCustomOpDouble(null,hash,inputBuffers,inputShapes,op.numInputArguments(),outputBuffers,outputShapes,op.numOutputArguments(),tArgs,op.numTArguments(),iArgs,op.numIArguments(),op.isInplaceCall()));
    }
 catch (    Exception e) {
      log.error("String_Node_Str",e);
    }
  }
 else   if (Nd4j.dataType() == DataBuffer.Type.HALF) {
    val tArgs=op.numTArguments() > 0 ? new ShortPointer(op.numTArguments()) : null;
    cnt=0;
    val tArgs1=op.tArgs();
    for (    val t : tArgs1)     tArgs.put(cnt++,ArrayUtil.toHalf(t));
    val status=OpStatus.byNumber(loop.execCustomOpHalf(null,hash,inputBuffers,inputShapes,op.numInputArguments(),outputBuffers,outputShapes,op.numOutputArguments(),tArgs,op.numTArguments(),iArgs,op.numIArguments(),op.isInplaceCall()));
    if (status != OpStatus.ND4J_STATUS_OK)     throw new ND4JIllegalStateException("String_Node_Str" + status);
  }
}

Fixed version (ground truth):
/** 
 * This method executes given CustomOp PLEASE NOTE: You're responsible for input/output validation
 * @param op
 */
public void exec(@NonNull CustomOp op){
  if (op.numOutputArguments() == 0 && !op.isInplaceCall())   throw new ND4JIllegalStateException("String_Node_Str");
  val hash=op.opHash();
  val inputShapes=new PointerPointer<>(op.numInputArguments());
  val inputBuffers=new PointerPointer<>(op.numInputArguments());
  int cnt=0;
  val inputArgs=op.inputArguments();
  for (  val in : inputArgs) {
    inputBuffers.put(cnt,in.data().addressPointer());
    inputShapes.put(cnt++,in.shapeInfoDataBuffer().addressPointer());
  }
  val outputArgs=op.outputArguments();
  for (int i=0; i < outputArgs.length; i++) {
    if (outputArgs[i] == null)     throw new ND4JIllegalStateException("String_Node_Str");
  }
  val outputShapes=new PointerPointer<>(op.numOutputArguments());
  val outputBuffers=new PointerPointer<>(op.numOutputArguments());
  cnt=0;
  for (  val out : outputArgs) {
    outputBuffers.put(cnt,out.data().addressPointer());
    outputShapes.put(cnt++,out.shapeInfoDataBuffer().addressPointer());
  }
  val iArgs=op.numIArguments() > 0 ? new IntPointer(op.numIArguments()) : null;
  cnt=0;
  val iArgs1=op.iArgs();
  for (  val i : iArgs1)   iArgs.put(cnt++,i);
  if (Nd4j.dataType() == DataBuffer.Type.FLOAT) {
    val tArgs=op.numTArguments() > 0 ? new FloatPointer(op.numTArguments()) : null;
    val tArgs1=op.tArgs();
    cnt=0;
    for (    val t : tArgs1)     tArgs.put(cnt++,(float)t);
    val status=OpStatus.byNumber(loop.execCustomOpFloat(null,hash,inputBuffers,inputShapes,op.numInputArguments(),outputBuffers,outputShapes,op.numOutputArguments(),tArgs,op.numTArguments(),iArgs,op.numIArguments(),op.isInplaceCall()));
    if (status != OpStatus.ND4J_STATUS_OK)     throw new ND4JIllegalStateException("String_Node_Str" + status);
  }
 else   if (Nd4j.dataType() == DataBuffer.Type.DOUBLE) {
    val tArgs=op.numTArguments() > 0 ? new DoublePointer(op.numTArguments()) : null;
    val tArgs1=op.tArgs();
    cnt=0;
    for (    val t : tArgs1)     tArgs.put(cnt++,t);
    OpStatus status=OpStatus.ND4J_STATUS_OK;
    try {
      status=OpStatus.byNumber(loop.execCustomOpDouble(null,hash,inputBuffers,inputShapes,op.numInputArguments(),outputBuffers,outputShapes,op.numOutputArguments(),tArgs,op.numTArguments(),iArgs,op.numIArguments(),op.isInplaceCall()));
    }
 catch (    Exception e) {
      log.error("String_Node_Str");
      throw e;
    }
  }
 else   if (Nd4j.dataType() == DataBuffer.Type.HALF) {
    val tArgs=op.numTArguments() > 0 ? new ShortPointer(op.numTArguments()) : null;
    cnt=0;
    val tArgs1=op.tArgs();
    for (    val t : tArgs1)     tArgs.put(cnt++,ArrayUtil.toHalf(t));
    val status=OpStatus.byNumber(loop.execCustomOpHalf(null,hash,inputBuffers,inputShapes,op.numInputArguments(),outputBuffers,outputShapes,op.numOutputArguments(),tArgs,op.numTArguments(),iArgs,op.numIArguments(),op.isInplaceCall()));
    if (status != OpStatus.ND4J_STATUS_OK)     throw new ND4JIllegalStateException("String_Node_Str" + status);
  }
}