Program: 45408
Project: 45408
Buggy source:
/** 
 * <PRE> Program Directives PackageDefinition Program <B>CLEARS unused buffers before returning</B></PRE>
 */
public ProgramNode parseProgram(){
  if (debug) {
    System.err.println("String_Node_Str");
  }
  StatementListNode first=null;
  StatementListNode second=null;
  StatementListNode configs=null;
  if (!parsing_include) {
    config_namespaces.push_back(new HashSet<String>());
    config_namespaces.last().add("String_Node_Str");
    configs=parseConfigValues();
  }
  while (lookahead(PACKAGE_TOKEN) || lookahead(DOCCOMMENT_TOKEN)) {
    MetaDataNode meta=null;
    if (lookahead(DOCCOMMENT_TOKEN) || lookahead(LEFTBRACKET_TOKEN) || lookahead(XMLLITERAL_TOKEN)) {
      meta=parseMetaData();
      second=nodeFactory.statementList(second,meta);
    }
    if (lookahead(PACKAGE_TOKEN)) {
      PackageDefinitionNode pkgdef=parsePackageDefinition();
      first=nodeFactory.statementList(first,pkgdef);
      if (meta != null) {
        meta.def=pkgdef;
        pkgdef.addMetaDataNode(meta);
      }
      if (pkgdef != null) {
        second=nodeFactory.statementList(second,pkgdef.statements);
      }
    }
  }
  second=parseDirectives(null,second);
  if ((ctx.dialect(10)) && !parsing_include && second != null) {
    Node udn=nodeFactory.useDirective(null,nodeFactory.memberExpression(null,nodeFactory.getExpression(nodeFactory.identifier("String_Node_Str"))));
    second.items.add(0,udn);
  }
  if (ctx.statics.es4_vectors) {
    PackageIdentifiersNode pin=nodeFactory.packageIdentifiers(null,nodeFactory.identifier("String_Node_Str"),true);
    pin=nodeFactory.packageIdentifiers(pin,nodeFactory.identifier("String_Node_Str"),true);
    pin=nodeFactory.packageIdentifiers(pin,nodeFactory.identifier("String_Node_Str"),true);
    Node idn=nodeFactory.importDirective(null,nodeFactory.packageName(pin),null,ctx);
    if (second != null)     second.items.add(0,idn);
  }
  ProgramNode result=nodeFactory.program(ctx,second,ctx.input.positionOfMark());
  match(EOS_TOKEN);
  if (ctx.scriptAssistParsing) {
    for (ListIterator<Node> it=comments.listIterator(); it.hasNext(); ) {
      ctx.comments.add(it.next());
    }
  }
  clearUnusedBuffers();
  if (!parsing_include) {
    if (result != null) {
      if (configs != null)       result.statements.items.addAll(0,configs.items);
      NamespaceDefinitionNode configdef=nodeFactory.configNamespaceDefinition(null,nodeFactory.identifier("String_Node_Str"),-1);
      result.statements.items.add(0,configdef);
    }
    config_namespaces.pop_back();
  }
  if (debug) {
    System.err.println("String_Node_Str");
  }
  return result;
}

Fixed version (ground truth):
/** 
 * <PRE> Program Directives PackageDefinition Program <B>CLEARS unused buffers before returning</B></PRE>
 */
public ProgramNode parseProgram(){
  if (debug) {
    System.err.println("String_Node_Str");
  }
  StatementListNode first=null;
  StatementListNode second=null;
  StatementListNode configs=null;
  if (!parsing_include) {
    config_namespaces.push_back(new HashSet<String>());
    config_namespaces.last().add("String_Node_Str");
    configs=parseConfigValues();
  }
  while (lookahead(PACKAGE_TOKEN) || lookahead(DOCCOMMENT_TOKEN)) {
    MetaDataNode meta=null;
    if (lookahead(DOCCOMMENT_TOKEN) || lookahead(LEFTBRACKET_TOKEN) || lookahead(XMLLITERAL_TOKEN)) {
      meta=parseMetaData();
      second=nodeFactory.statementList(second,meta);
    }
    if (lookahead(PACKAGE_TOKEN)) {
      PackageDefinitionNode pkgdef=parsePackageDefinition();
      first=nodeFactory.statementList(first,pkgdef);
      if (meta != null) {
        meta.def=pkgdef;
        pkgdef.addMetaDataNode(meta);
      }
      if (pkgdef != null) {
        second=nodeFactory.statementList(second,pkgdef.statements);
      }
    }
  }
  second=parseDirectives(null,second);
  if ((ctx.dialect(10)) && !parsing_include && second != null) {
    Node udn=nodeFactory.useDirective(null,nodeFactory.memberExpression(null,nodeFactory.getExpression(nodeFactory.identifier("String_Node_Str"))));
    second.items.add(0,udn);
  }
  if (ctx.statics.es4_vectors && !parsing_include && second != null) {
    PackageIdentifiersNode pin=nodeFactory.packageIdentifiers(null,nodeFactory.identifier("String_Node_Str"),true);
    pin=nodeFactory.packageIdentifiers(pin,nodeFactory.identifier("String_Node_Str"),true);
    pin=nodeFactory.packageIdentifiers(pin,nodeFactory.identifier("String_Node_Str"),true);
    Node idn=nodeFactory.importDirective(null,nodeFactory.packageName(pin),null,ctx);
    second.items.add(0,idn);
  }
  ProgramNode result=nodeFactory.program(ctx,second,ctx.input.positionOfMark());
  match(EOS_TOKEN);
  if (ctx.scriptAssistParsing) {
    for (ListIterator<Node> it=comments.listIterator(); it.hasNext(); ) {
      ctx.comments.add(it.next());
    }
  }
  clearUnusedBuffers();
  if (!parsing_include) {
    if (result != null) {
      if (configs != null)       result.statements.items.addAll(0,configs.items);
      NamespaceDefinitionNode configdef=nodeFactory.configNamespaceDefinition(null,nodeFactory.identifier("String_Node_Str"),-1);
      result.statements.items.add(0,configdef);
    }
    config_namespaces.pop_back();
  }
  if (debug) {
    System.err.println("String_Node_Str");
  }
  return result;
}