Program: 58373
Project: 58373
Buggy source:
@Override public boolean encode(){
  int i, j;
  int est_binlen;
  EccMode ecc_level;
  int max_cw;
  int autosize;
  int target_binlen, version, blocks;
  int size;
  int bitmask;
  String bin;
  if (debug) {
    System.out.printf("String_Node_Str",content);
  }
  inputMode=new qrMode[content.length()];
  define_mode();
  est_binlen=estimate_binary_length();
  ecc_level=preferredEccLevel;
switch (preferredEccLevel) {
case L:
    max_cw=2956;
  break;
case M:
max_cw=2334;
break;
case Q:
max_cw=1666;
break;
case H:
max_cw=1276;
break;
default :
max_cw=2956;
break;
}
if (est_binlen > (8 * max_cw)) {
error_msg="String_Node_Str";
return false;
}
autosize=40;
for (i=39; i >= 0; i--) {
switch (ecc_level) {
case L:
if ((8 * qr_data_codewords_L[i]) >= est_binlen) {
autosize=i + 1;
}
break;
case M:
if ((8 * qr_data_codewords_M[i]) >= est_binlen) {
autosize=i + 1;
}
break;
case Q:
if ((8 * qr_data_codewords_Q[i]) >= est_binlen) {
autosize=i + 1;
}
break;
case H:
if ((8 * qr_data_codewords_H[i]) >= est_binlen) {
autosize=i + 1;
}
break;
}
}
version=autosize;
if ((preferredVersion >= 1) && (preferredVersion <= 40)) {
if (preferredVersion > autosize) {
version=preferredVersion;
}
}
if (est_binlen <= qr_data_codewords_M[version - 1]) {
ecc_level=EccMode.M;
}
if (est_binlen <= qr_data_codewords_Q[version - 1]) {
ecc_level=EccMode.Q;
}
if (est_binlen <= qr_data_codewords_H[version - 1]) {
ecc_level=EccMode.H;
}
target_binlen=qr_data_codewords_L[version - 1];
blocks=qr_blocks_L[version - 1];
switch (ecc_level) {
case M:
target_binlen=qr_data_codewords_M[version - 1];
blocks=qr_blocks_M[version - 1];
break;
case Q:
target_binlen=qr_data_codewords_Q[version - 1];
blocks=qr_blocks_Q[version - 1];
break;
case H:
target_binlen=qr_data_codewords_H[version - 1];
blocks=qr_blocks_H[version - 1];
break;
}
datastream=new int[target_binlen + 1];
fullstream=new int[qr_total_codewords[version - 1] + 1];
if (!(qr_binary(version,target_binlen,est_binlen))) {
return false;
}
add_ecc(version,target_binlen,blocks);
size=qr_sizes[version - 1];
grid=new byte[size * size];
encodeInfo+="String_Node_Str" + version + "String_Node_Str";
encodeInfo+="String_Node_Str";
switch (ecc_level) {
case L:
encodeInfo+="String_Node_Str";
break;
case M:
encodeInfo+="String_Node_Str";
break;
case Q:
encodeInfo+="String_Node_Str";
break;
case H:
default :
encodeInfo+="String_Node_Str";
break;
}
for (i=0; i < size; i++) {
for (j=0; j < size; j++) {
grid[(i * size) + j]=0;
}
}
setup_grid(size,version);
populate_grid(size,qr_total_codewords[version - 1]);
bitmask=apply_bitmask(size);
encodeInfo+="String_Node_Str" + Integer.toBinaryString(bitmask) + "String_Node_Str";
add_format_info(size,ecc_level,bitmask);
if (version >= 7) {
add_version_info(size,version);
}
readable="String_Node_Str";
pattern=new String[size];
row_count=size;
row_height=new int[size];
for (i=0; i < size; i++) {
bin="String_Node_Str";
for (j=0; j < size; j++) {
if ((grid[(i * size) + j] & 0x01) != 0) {
bin+="String_Node_Str";
}
 else {
bin+="String_Node_Str";
}
}
pattern[i]=bin2pat(bin);
row_height[i]=1;
}
plotSymbol();
return true;
}

Fixed version (ground truth):
@Override public boolean encode(){
  int i, j;
  int est_binlen;
  EccMode ecc_level;
  int max_cw;
  int autosize;
  int targetCwCount, version, blocks;
  int size;
  int bitmask;
  String bin;
  if (debug) {
    System.out.printf("String_Node_Str",content);
  }
  inputMode=new qrMode[content.length()];
  define_mode();
  est_binlen=estimate_binary_length();
  ecc_level=preferredEccLevel;
switch (preferredEccLevel) {
case L:
    max_cw=2956;
  break;
case M:
max_cw=2334;
break;
case Q:
max_cw=1666;
break;
case H:
max_cw=1276;
break;
default :
max_cw=2956;
break;
}
if (est_binlen > (8 * max_cw)) {
error_msg="String_Node_Str";
return false;
}
autosize=40;
for (i=39; i >= 0; i--) {
switch (ecc_level) {
case L:
if ((8 * qr_data_codewords_L[i]) >= est_binlen) {
autosize=i + 1;
}
break;
case M:
if ((8 * qr_data_codewords_M[i]) >= est_binlen) {
autosize=i + 1;
}
break;
case Q:
if ((8 * qr_data_codewords_Q[i]) >= est_binlen) {
autosize=i + 1;
}
break;
case H:
if ((8 * qr_data_codewords_H[i]) >= est_binlen) {
autosize=i + 1;
}
break;
}
}
version=autosize;
if ((preferredVersion >= 1) && (preferredVersion <= 40)) {
if (preferredVersion > autosize) {
version=preferredVersion;
}
}
if (est_binlen <= (qr_data_codewords_M[version - 1] * 8)) {
ecc_level=EccMode.M;
}
if (est_binlen <= (qr_data_codewords_Q[version - 1] * 8)) {
ecc_level=EccMode.Q;
}
if (est_binlen <= (qr_data_codewords_H[version - 1] * 8)) {
ecc_level=EccMode.H;
}
targetCwCount=qr_data_codewords_L[version - 1];
blocks=qr_blocks_L[version - 1];
switch (ecc_level) {
case M:
targetCwCount=qr_data_codewords_M[version - 1];
blocks=qr_blocks_M[version - 1];
break;
case Q:
targetCwCount=qr_data_codewords_Q[version - 1];
blocks=qr_blocks_Q[version - 1];
break;
case H:
targetCwCount=qr_data_codewords_H[version - 1];
blocks=qr_blocks_H[version - 1];
break;
}
datastream=new int[targetCwCount + 1];
fullstream=new int[qr_total_codewords[version - 1] + 1];
if (!(qr_binary(version,targetCwCount))) {
return false;
}
add_ecc(version,targetCwCount,blocks);
size=qr_sizes[version - 1];
grid=new byte[size * size];
encodeInfo+="String_Node_Str" + version + "String_Node_Str";
encodeInfo+="String_Node_Str";
switch (ecc_level) {
case L:
encodeInfo+="String_Node_Str";
break;
case M:
encodeInfo+="String_Node_Str";
break;
case Q:
encodeInfo+="String_Node_Str";
break;
case H:
default :
encodeInfo+="String_Node_Str";
break;
}
for (i=0; i < size; i++) {
for (j=0; j < size; j++) {
grid[(i * size) + j]=0;
}
}
setup_grid(size,version);
populate_grid(size,qr_total_codewords[version - 1]);
bitmask=apply_bitmask(size);
encodeInfo+="String_Node_Str" + Integer.toBinaryString(bitmask) + "String_Node_Str";
add_format_info(size,ecc_level,bitmask);
if (version >= 7) {
add_version_info(size,version);
}
readable="String_Node_Str";
pattern=new String[size];
row_count=size;
row_height=new int[size];
for (i=0; i < size; i++) {
bin="String_Node_Str";
for (j=0; j < size; j++) {
if ((grid[(i * size) + j] & 0x01) != 0) {
bin+="String_Node_Str";
}
 else {
bin+="String_Node_Str";
}
}
pattern[i]=bin2pat(bin);
row_height[i]=1;
}
plotSymbol();
return true;
}