Program: 58378
Project: 58378
Buggy source:
@Override public boolean encode(){
  int input_length, i, j, k, h;
  int min_module_height;
  Mode last_mode, this_mode;
  double estimate_codelength;
  String row_pattern;
  int[] row_indicator=new int[44];
  int[] row_check=new int[44];
  int k1_sum, k2_sum;
  int k1_check, k2_check;
  byte[] inputBytes;
  int writer, flip_flop;
  source=new int[content.length()];
  input_length=content.length();
  final_mode=cfMode.MODEA;
  if (input_length > 5450) {
    error_msg="String_Node_Str";
    return false;
  }
  try {
    inputBytes=content.getBytes("String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    error_msg="String_Node_Str";
    return false;
  }
  source=new int[input_length];
  for (i=0; i < input_length; i++) {
    source[i]=inputBytes[i] & 0xFF;
  }
  estimate_codelength=0.0;
  last_mode=Mode.AORB;
  for (i=0; i < input_length; i++) {
    this_mode=findSubset(source[i]);
    if (this_mode != last_mode) {
      estimate_codelength+=1.0;
    }
    if (this_mode != Mode.ABORC) {
      estimate_codelength+=1.0;
    }
 else {
      estimate_codelength+=0.5;
    }
    if (source[i] > 127) {
      estimate_codelength+=1.0;
    }
    last_mode=this_mode;
  }
  rows_needed=(int)(0.5 + Math.sqrt((estimate_codelength + 2) / 1.45));
  if (rows_needed < 2) {
    rows_needed=2;
  }
  if (rows_needed > 44) {
    rows_needed=44;
  }
  columns_needed=(int)(estimate_codelength + 2) / rows_needed;
  if (columns_needed < 4) {
    columns_needed=4;
  }
  if (columns_needed > 62) {
    error_msg="String_Node_Str";
    return false;
  }
  if (!(data_encode_blockf())) {
    return false;
  }
  k1_sum=0;
  k2_sum=0;
  for (i=0; i < input_length; i++) {
    if (gs1 && source[i] == '[') {
      k1_sum+=(i + 1) * 29;
      k2_sum+=i * 29;
    }
 else {
      k1_sum+=(i + 1) * source[i];
      k2_sum+=i * source[i];
    }
  }
  k1_check=k1_sum % 86;
  k2_check=k2_sum % 86;
  if ((final_mode == cfMode.MODEA) || (final_mode == cfMode.MODEB)) {
    k1_check=k1_check + 64;
    if (k1_check > 95) {
      k1_check-=96;
    }
    k2_check=k2_check + 64;
    if (k2_check > 95) {
      k2_check-=96;
    }
  }
  blockmatrix[rows_needed - 1][columns_needed - 2]=k1_check;
  blockmatrix[rows_needed - 1][columns_needed - 1]=k2_check;
  min_module_height=(int)(0.55 * (columns_needed + 3)) + 3;
  if (min_module_height < 8) {
    min_module_height=8;
  }
  if (subset_selector[0] == cfMode.MODEC) {
    row_indicator[0]=rows_needed - 2;
  }
 else {
    row_indicator[0]=rows_needed + 62;
    if (row_indicator[0] > 95) {
      row_indicator[0]-=95;
    }
  }
  for (i=1; i < rows_needed; i++) {
    if (subset_selector[i] == cfMode.MODEC) {
      row_indicator[i]=i + 42;
    }
 else {
      if (i < 6)       row_indicator[i]=i + 10;
 else       row_indicator[i]=i + 20;
    }
  }
  for (i=0; i < rows_needed; i++) {
    k=103;
switch (subset_selector[i]) {
case MODEA:
      k+=98;
    break;
case MODEB:
  k+=100;
break;
case MODEC:
k+=99;
break;
}
k+=2 * row_indicator[i];
for (j=0; j < columns_needed; j++) {
k+=(j + 3) * blockmatrix[i][j];
}
row_check[i]=k % 103;
}
readable="String_Node_Str";
row_count=rows_needed;
pattern=new String[row_count];
row_height=new int[row_count];
encodeInfo+="String_Node_Str" + columns_needed + "String_Node_Str"+ rows_needed+ '\n';
encodeInfo+="String_Node_Str" + k1_check + "String_Node_Str";
encodeInfo+="String_Node_Str" + k2_check + "String_Node_Str";
for (i=0; i < rows_needed; i++) {
if (debug) {
System.out.printf("String_Node_Str",i);
switch (subset_selector[i]) {
case MODEA:
System.out.print("String_Node_Str");
break;
case MODEB:
System.out.print("String_Node_Str");
break;
case MODEC:
System.out.print("String_Node_Str");
break;
}
System.out.printf("String_Node_Str",row_indicator[i]);
for (j=0; j < columns_needed; j++) {
System.out.printf("String_Node_Str",blockmatrix[i][j]);
}
System.out.printf("String_Node_Str",row_check[i]);
}
row_pattern="String_Node_Str";
row_pattern+=C128Table[103];
switch (subset_selector[i]) {
case MODEA:
row_pattern+=C128Table[98];
break;
case MODEB:
row_pattern+=C128Table[100];
break;
case MODEC:
row_pattern+=C128Table[99];
break;
}
row_pattern+=C128Table[row_indicator[i]];
for (j=0; j < columns_needed; j++) {
row_pattern+=C128Table[blockmatrix[i][j]];
}
row_pattern+=C128Table[row_check[i]];
row_pattern+=C128Table[106];
pattern[i]=row_pattern;
row_height[i]=15;
}
symbol_height=rows_needed * 15;
plotSymbol();
return true;
}

Fixed version (ground truth):
@Override public boolean encode(){
  int input_length, i, j, k, h;
  int min_module_height;
  Mode last_mode, this_mode;
  double estimate_codelength;
  String row_pattern;
  int[] row_indicator=new int[44];
  int[] row_check=new int[44];
  int k1_sum, k2_sum;
  int k1_check, k2_check;
  byte[] inputBytes;
  input_length=content.length();
  final_mode=cfMode.MODEA;
  if (input_length > 5450) {
    error_msg="String_Node_Str";
    return false;
  }
  try {
    inputBytes=content.getBytes("String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    error_msg="String_Node_Str";
    return false;
  }
  source=new int[input_length + 1];
  for (i=0; i < input_length; i++) {
    source[i]=inputBytes[i] & 0xFF;
  }
  source[input_length]=0x00;
  estimate_codelength=0.0;
  last_mode=Mode.AORB;
  for (i=0; i < input_length; i++) {
    this_mode=findSubset(source[i]);
    if (this_mode != last_mode) {
      estimate_codelength+=1.0;
    }
    if (this_mode != Mode.ABORC) {
      estimate_codelength+=1.0;
    }
 else {
      estimate_codelength+=0.5;
    }
    if (source[i] > 127) {
      estimate_codelength+=1.0;
    }
    last_mode=this_mode;
  }
  rows_needed=(int)(0.5 + Math.sqrt((estimate_codelength + 2) / 1.45));
  if (rows_needed < 2) {
    rows_needed=2;
  }
  if (rows_needed > 44) {
    rows_needed=44;
  }
  columns_needed=(int)(estimate_codelength + 2) / rows_needed;
  if (columns_needed < 4) {
    columns_needed=4;
  }
  if (columns_needed > 62) {
    error_msg="String_Node_Str";
    return false;
  }
  if (!(data_encode_blockf())) {
    return false;
  }
  k1_sum=0;
  k2_sum=0;
  for (i=0; i < input_length; i++) {
    if (gs1 && source[i] == '[') {
      k1_sum+=(i + 1) * 29;
      k2_sum+=i * 29;
    }
 else {
      k1_sum+=(i + 1) * source[i];
      k2_sum+=i * source[i];
    }
  }
  k1_check=k1_sum % 86;
  k2_check=k2_sum % 86;
  if ((final_mode == cfMode.MODEA) || (final_mode == cfMode.MODEB)) {
    k1_check=k1_check + 64;
    if (k1_check > 95) {
      k1_check-=96;
    }
    k2_check=k2_check + 64;
    if (k2_check > 95) {
      k2_check-=96;
    }
  }
  blockmatrix[rows_needed - 1][columns_needed - 2]=k1_check;
  blockmatrix[rows_needed - 1][columns_needed - 1]=k2_check;
  min_module_height=(int)(0.55 * (columns_needed + 3)) + 3;
  if (min_module_height < 8) {
    min_module_height=8;
  }
  if (subset_selector[0] == cfMode.MODEC) {
    row_indicator[0]=rows_needed - 2;
  }
 else {
    row_indicator[0]=rows_needed + 62;
    if (row_indicator[0] > 95) {
      row_indicator[0]-=95;
    }
  }
  for (i=1; i < rows_needed; i++) {
    if (subset_selector[i] == cfMode.MODEC) {
      row_indicator[i]=i + 42;
    }
 else {
      if (i < 6)       row_indicator[i]=i + 10;
 else       row_indicator[i]=i + 20;
    }
  }
  for (i=0; i < rows_needed; i++) {
    k=103;
switch (subset_selector[i]) {
case MODEA:
      k+=98;
    break;
case MODEB:
  k+=100;
break;
case MODEC:
k+=99;
break;
}
k+=2 * row_indicator[i];
for (j=0; j < columns_needed; j++) {
k+=(j + 3) * blockmatrix[i][j];
}
row_check[i]=k % 103;
}
readable="String_Node_Str";
row_count=rows_needed;
pattern=new String[row_count];
row_height=new int[row_count];
encodeInfo+="String_Node_Str" + columns_needed + "String_Node_Str"+ rows_needed+ '\n';
encodeInfo+="String_Node_Str" + k1_check + "String_Node_Str";
encodeInfo+="String_Node_Str" + k2_check + "String_Node_Str";
for (i=0; i < rows_needed; i++) {
if (debug) {
System.out.printf("String_Node_Str",i);
switch (subset_selector[i]) {
case MODEA:
System.out.print("String_Node_Str");
break;
case MODEB:
System.out.print("String_Node_Str");
break;
case MODEC:
System.out.print("String_Node_Str");
break;
}
System.out.printf("String_Node_Str",row_indicator[i]);
for (j=0; j < columns_needed; j++) {
System.out.printf("String_Node_Str",blockmatrix[i][j]);
}
System.out.printf("String_Node_Str",row_check[i]);
}
row_pattern="String_Node_Str";
row_pattern+=C128Table[103];
switch (subset_selector[i]) {
case MODEA:
row_pattern+=C128Table[98];
break;
case MODEB:
row_pattern+=C128Table[100];
break;
case MODEC:
row_pattern+=C128Table[99];
break;
}
row_pattern+=C128Table[row_indicator[i]];
for (j=0; j < columns_needed; j++) {
row_pattern+=C128Table[blockmatrix[i][j]];
}
row_pattern+=C128Table[row_check[i]];
row_pattern+=C128Table[106];
pattern[i]=row_pattern;
row_height[i]=15;
}
symbol_height=rows_needed * 15;
plotSymbol();
return true;
}