Program: 45396
Project: 45396
Buggy source:
protected int FinishMethod(Context cx,final String name,TypeInfo type,ObjectList<TypeInfo> types,ObjectValue activation,int needs_arguments,int scope_depth,String debug_name,boolean is_native,boolean is_interface,String[] arg_names){
  if (show_instructions) {
    code_out.println();
    code_out.print("String_Node_Str" + name + "String_Node_Str"+ debug_name);
  }
  showLineNumber();
  int method_info=GetMethodInfo(name);
  ObjectList<ByteList> traits=new ObjectList<ByteList>();
  if (activation != null) {
    ObjectValue obj=activation;
    FinishTraits(obj,traits);
  }
  int flags=0;
  flags|=needs_arguments;
  flags|=activation != null ? METHOD_Activation : 0;
  int debug_name_index=ab.addUtf8Constant(bytecodeFactory.ConstantUtf8Info(emit_debug_info ? debug_name : "String_Node_Str"));
  if (is_native) {
    flags|=METHOD_Native;
  }
  if (sets_dxns) {
    flags|=METHOD_Setsdxns;
  }
  int return_type=type != null ? addClassName(type.getName(cx)) : 0;
  IntList param_types=null;
  IntList param_values=null;
  ByteList param_kinds=null;
{
    ObjectValue obj=cx.scope();
    Slots slots=obj.slots;
    if (slots != null) {
      param_types=new IntList(slots.size());
      param_values=new IntList(slots.size());
      param_kinds=new ByteList(slots.size());
      Iterator<Slot> it=slots.iterator();
      boolean value_required=false;
      for (int i=1; it.hasNext() && i < max_params; ++i) {
        Slot slot=it.next();
        int type_index=addClassName(slot.getType().getName(cx));
        param_types.add(type_index);
        int value_index=0;
        byte value_kind=0;
        ObjectValue iv=slot.getInitializerValue();
        if (iv != null) {
          value_required=true;
          String value=iv.toString();
          NumberUsage numberUsage=iv.getNumberUsage();
          TypeValue defaultValueType=slot.getInitializerValue().type != null ? slot.getInitializerValue().type.getTypeValue() : null;
          if (defaultValueType == cx.booleanType()) {
            value_index=value.equals("String_Node_Str") ? CONSTANT_True : CONSTANT_False;
            value_kind=value.equals("String_Node_Str") ? CONSTANT_True : CONSTANT_False;
          }
 else           if (defaultValueType == cx.stringType()) {
            value_index=ab.addUtf8Constant(bytecodeFactory.ConstantUtf8Info(value));
            value_kind=CONSTANT_Utf8;
          }
 else           if (defaultValueType == cx.intType()) {
            value_index=ab.addIntConstant(bytecodeFactory.ConstantIntegerInfo(getValueOfNumberLiteral(value,new TypeValue[1],numberUsage).intValue()));
            value_kind=CONSTANT_Integer;
          }
 else           if ((defaultValueType == cx.doubleType()) || (cx.abcVersion(Features.TARGET_AVM1) && (defaultValueType == cx.uintType()))) {
            value_index=ab.addDoubleConstant(bytecodeFactory.ConstantDoubleInfo(getValueOfNumberLiteral(value,new TypeValue[1],numberUsage).doubleValue()));
            value_kind=CONSTANT_Double;
          }
 else           if (defaultValueType == cx.uintType()) {
            value_index=ab.addUintConstant(bytecodeFactory.ConstantUintInfo(getValueOfNumberLiteral(value,new TypeValue[1],numberUsage).uintValue()));
            value_kind=CONSTANT_UInteger;
          }
 else           if (cx.statics.es4_numerics && (defaultValueType == cx.decimalType())) {
            value_index=ab.addDecimalConstant(bytecodeFactory.ConstantDecimalInfo(getValueOfNumberLiteral(value,new TypeValue[1],numberUsage).decimalValue()));
            value_kind=CONSTANT_Decimal;
          }
 else           if (defaultValueType == cx.nullType()) {
            value_index=CONSTANT_Null;
            value_kind=CONSTANT_Null;
          }
 else           if (defaultValueType == cx.voidType()) {
            value_index=0;
            value_kind=0;
          }
 else           if (slot.getInitializerValue() instanceof NamespaceValue) {
            value_index=addNamespace(slot.getInitializerValue());
            value_kind=CONSTANT_Namespace;
          }
        }
        if (value_required) {
          param_values.add(value_index);
          param_kinds.add(value_kind);
        }
      }
      if (value_required) {
        flags|=METHOD_HasOptional;
      }
    }
  }
  IntList param_names=null;
  if (emit_debug_info && arg_names != null) {
    flags|=METHOD_HasParamNames;
    param_names=new IntList(arg_names.length);
    for (int x=0; x < arg_names.length; ++x) {
      param_names.add(ab.addUtf8Constant(bytecodeFactory.ConstantUtf8Info(arg_names[x])));
    }
  }
{
    bytecodeFactory.MethodInfo(ab.methods.at(method_info),max_params - 1,return_type,param_types,param_values,param_kinds,param_names,debug_name_index,flags,method_info);
  }
  if (!is_native) {
    if (!is_interface) {
      ab.addBody(bytecodeFactory.MethodBody(allocBytes(),(short)max_stack,max_locals,scope_depth,scope_depth + max_scope,ab.code.size(),ab.code,ab.exception_count,ab.exception_table,traits,method_info));
    }
  }
 else {
    String constName=debug_name.replace('.','_');
    constName=constName.replace('/','_');
    constName=constName.replace(':','_');
    constName=constName.replace('|','_');
    constName=constName.replace('$','_');
    header_out.println("String_Node_Str" + constName + "String_Node_Str"+ method_info+ "String_Node_Str");
    if (method_info >= native_method_count)     native_method_count=method_info + 1;
  }
  cur_locals=max_locals=0;
  ab.exception_count=0;
  ab.exception_table.clear();
  return method_info;
}

Fixed version (ground truth):
protected int FinishMethod(Context cx,final String name,TypeInfo type,ObjectList<TypeInfo> types,ObjectValue activation,int needs_arguments,int scope_depth,String debug_name,boolean is_native,boolean is_interface,String[] arg_names){
  if (show_instructions) {
    code_out.println();
    code_out.print("String_Node_Str" + name + "String_Node_Str"+ debug_name);
  }
  showLineNumber();
  int method_info=GetMethodInfo(name);
  ObjectList<ByteList> traits=new ObjectList<ByteList>();
  if (activation != null) {
    ObjectValue obj=activation;
    FinishTraits(obj,traits);
  }
  int flags=0;
  flags|=needs_arguments;
  flags|=activation != null ? METHOD_Activation : 0;
  int debug_name_index=ab.addUtf8Constant(bytecodeFactory.ConstantUtf8Info(emit_debug_info ? debug_name : "String_Node_Str"));
  if (is_native) {
    flags|=METHOD_Native;
  }
  if (sets_dxns) {
    flags|=METHOD_Setsdxns;
  }
  int return_type=type != null ? addClassName(type.getName(cx)) : 0;
  IntList param_types=null;
  IntList param_values=null;
  ByteList param_kinds=null;
{
    ObjectValue obj=cx.scope();
    Slots slots=obj.slots;
    if (slots != null) {
      param_types=new IntList(slots.size());
      param_values=new IntList(slots.size());
      param_kinds=new ByteList(slots.size());
      Iterator<Slot> it=slots.iterator();
      boolean value_required=false;
      for (int i=1; it.hasNext() && i < max_params; ++i) {
        Slot slot=it.next();
        int type_index=addClassName(slot.getType().getName(cx));
        param_types.add(type_index);
        int value_index=0;
        byte value_kind=0;
        ObjectValue iv=slot.getInitializerValue();
        if (iv != null) {
          value_required=true;
          String value=iv.toString();
          NumberUsage numberUsage=iv.getNumberUsage();
          TypeValue defaultValueType=slot.getInitializerValue().type != null ? slot.getInitializerValue().type.getTypeValue() : null;
          if (defaultValueType == cx.booleanType()) {
            value_index=value.equals("String_Node_Str") ? CONSTANT_True : CONSTANT_False;
            value_kind=value.equals("String_Node_Str") ? CONSTANT_True : CONSTANT_False;
          }
 else           if (defaultValueType == cx.stringType()) {
            value_index=ab.addUtf8Constant(bytecodeFactory.ConstantUtf8Info(value));
            value_kind=CONSTANT_Utf8;
          }
 else           if (defaultValueType == cx.intType()) {
            value_index=ab.addIntConstant(bytecodeFactory.ConstantIntegerInfo(getValueOfNumberLiteral(value,new TypeValue[1],numberUsage).intValue()));
            value_kind=CONSTANT_Integer;
          }
 else           if ((defaultValueType == cx.doubleType()) || (cx.abcVersion(Features.TARGET_AVM1) && (defaultValueType == cx.uintType()))) {
            value_index=ab.addDoubleConstant(bytecodeFactory.ConstantDoubleInfo(getValueOfNumberLiteral(value,new TypeValue[1],numberUsage).doubleValue()));
            value_kind=CONSTANT_Double;
          }
 else           if (defaultValueType == cx.uintType()) {
            value_index=ab.addUintConstant(bytecodeFactory.ConstantUintInfo(getValueOfNumberLiteral(value,new TypeValue[1],numberUsage).uintValue()));
            value_kind=CONSTANT_UInteger;
          }
 else           if (cx.statics.es4_numerics && (defaultValueType == cx.decimalType())) {
            value_index=ab.addDecimalConstant(bytecodeFactory.ConstantDecimalInfo(getValueOfNumberLiteral(value,new TypeValue[1],numberUsage).decimalValue()));
            value_kind=CONSTANT_Decimal;
          }
 else           if (defaultValueType == cx.nullType()) {
            value_index=CONSTANT_Null;
            value_kind=CONSTANT_Null;
          }
 else           if (defaultValueType == cx.voidType()) {
            value_index=0;
            value_kind=0;
          }
 else           if (slot.getInitializerValue() instanceof NamespaceValue) {
            value_index=addNamespace(slot.getInitializerValue());
            value_kind=CONSTANT_Namespace;
          }
        }
        if (value_required) {
          param_values.add(value_index);
          param_kinds.add(value_kind);
        }
      }
      if (value_required) {
        flags|=METHOD_HasOptional;
      }
    }
  }
  IntList param_names=null;
  if (emit_debug_info && arg_names != null) {
    flags|=METHOD_HasParamNames;
    param_names=new IntList(arg_names.length);
    for (int x=0; x < arg_names.length; ++x) {
      param_names.add(ab.addUtf8Constant(bytecodeFactory.ConstantUtf8Info(arg_names[x])));
    }
  }
{
    bytecodeFactory.MethodInfo(ab.methods.at(method_info),max_params - 1,return_type,param_types,param_values,param_kinds,param_names,debug_name_index,flags,method_info);
  }
  if (!is_native) {
    if (!is_interface) {
      ab.addBody(bytecodeFactory.MethodBody(allocBytes(),(short)max_stack,max_locals,scope_depth,scope_depth + max_scope,ab.code.size(),ab.code,ab.exception_count,ab.exception_table,traits,method_info));
    }
  }
 else {
    String constName=debug_name.replace('.','_');
    constName=constName.replace('/','_');
    constName=constName.replace(':','_');
    constName=constName.replace('|','_');
    constName=constName.replace('$','_');
    header_out.println("String_Node_Str" + constName + "String_Node_Str"+ method_info+ "String_Node_Str");
    if (method_info >= native_method_count)     native_method_count=method_info + 1;
  }
  cur_locals=max_locals=0;
  ab.exception_count=0;
  ab.exception_table.clear();
  clearPositionInfo();
  return method_info;
}