Program: 79881
Project: 79881
Buggy source:
@Override public boolean setStaticPokemon(List<Pokemon> staticPokemon){
  if (!romEntry.staticPokemonSupport) {
    return false;
  }
  int sptsize=romEntry.arrayEntries.containsKey("String_Node_Str") ? romEntry.arrayEntries.get("String_Node_Str").length : 0;
  int meggsize=romEntry.getInt("String_Node_Str") > 0 ? 1 : 0;
  if (staticPokemon.size() != romEntry.staticPokemon.size() + sptsize + meggsize) {
    return false;
  }
  try {
    Iterator<Pokemon> statics=staticPokemon.iterator();
    NARCContents scriptNARC=scriptNarc;
    for (    StaticPokemon statP : romEntry.staticPokemon) {
      statP.setPokemon(this,scriptNARC,statics.next());
    }
    if (romEntry.arrayEntries.containsKey("String_Node_Str")) {
      NARCContents tradeNARC=this.readNARC(romEntry.getString("String_Node_Str"));
      int[] trades=romEntry.arrayEntries.get("String_Node_Str");
      for (      int tradeNum : trades) {
        Pokemon thisTrade=statics.next();
        List<Integer> possibleAbilities=new ArrayList<Integer>();
        possibleAbilities.add(thisTrade.ability1);
        if (thisTrade.ability2 > 0) {
          possibleAbilities.add(thisTrade.ability2);
        }
        if (thisTrade.ability3 > 0) {
          possibleAbilities.add(thisTrade.ability3);
        }
        writeLong(tradeNARC.files.get(tradeNum),0,thisTrade.number);
        writeLong(tradeNARC.files.get(tradeNum),0x1C,possibleAbilities.get(RandomSource.nextInt(possibleAbilities.size())));
      }
      writeNARC(romEntry.getString("String_Node_Str"),tradeNARC);
    }
    if (romEntry.getInt("String_Node_Str") > 0) {
      int pokenum=statics.next().number;
      if (pokenum > 255) {
        pokenum=RandomSource.nextInt(255) + 1;
      }
      byte[] ovOverlay=readOverlay(romEntry.getInt("String_Node_Str"));
      ovOverlay[romEntry.getInt("String_Node_Str")]=(byte)pokenum;
      writeOverlay(romEntry.getInt("String_Node_Str"),ovOverlay);
    }
    if (romEntry.getInt("String_Node_Str") > 0) {
      int baseOffset=romEntry.getInt("String_Node_Str");
      if (romEntry.romType == Type_HGSS) {
        byte[] ftData=readOverlay(romEntry.getInt("String_Node_Str"));
        for (int f=0; f < 7; f++) {
          int pokenum=statics.next().number;
          writeWord(ftData,baseOffset + 2 + f * 4,pokenum);
        }
        writeOverlay(romEntry.getInt("String_Node_Str"),ftData);
      }
 else {
        for (int f=0; f < 7; f++) {
          int pokenum=statics.next().number;
          writeWord(arm9,baseOffset + 2 + f * 4,pokenum);
        }
      }
    }
  }
 catch (  IOException e) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean setStaticPokemon(List<Pokemon> staticPokemon){
  if (!romEntry.staticPokemonSupport) {
    return false;
  }
  int sptsize=romEntry.arrayEntries.containsKey("String_Node_Str") ? romEntry.arrayEntries.get("String_Node_Str").length : 0;
  int meggsize=romEntry.getInt("String_Node_Str") > 0 ? 1 : 0;
  int fossilsize=romEntry.getInt("String_Node_Str") > 0 ? 7 : 0;
  if (staticPokemon.size() != romEntry.staticPokemon.size() + sptsize + meggsize+ fossilsize) {
    return false;
  }
  try {
    Iterator<Pokemon> statics=staticPokemon.iterator();
    NARCContents scriptNARC=scriptNarc;
    for (    StaticPokemon statP : romEntry.staticPokemon) {
      statP.setPokemon(this,scriptNARC,statics.next());
    }
    if (romEntry.arrayEntries.containsKey("String_Node_Str")) {
      NARCContents tradeNARC=this.readNARC(romEntry.getString("String_Node_Str"));
      int[] trades=romEntry.arrayEntries.get("String_Node_Str");
      for (      int tradeNum : trades) {
        Pokemon thisTrade=statics.next();
        List<Integer> possibleAbilities=new ArrayList<Integer>();
        possibleAbilities.add(thisTrade.ability1);
        if (thisTrade.ability2 > 0) {
          possibleAbilities.add(thisTrade.ability2);
        }
        if (thisTrade.ability3 > 0) {
          possibleAbilities.add(thisTrade.ability3);
        }
        writeLong(tradeNARC.files.get(tradeNum),0,thisTrade.number);
        writeLong(tradeNARC.files.get(tradeNum),0x1C,possibleAbilities.get(RandomSource.nextInt(possibleAbilities.size())));
      }
      writeNARC(romEntry.getString("String_Node_Str"),tradeNARC);
    }
    if (romEntry.getInt("String_Node_Str") > 0) {
      int pokenum=statics.next().number;
      if (pokenum > 255) {
        pokenum=RandomSource.nextInt(255) + 1;
      }
      byte[] ovOverlay=readOverlay(romEntry.getInt("String_Node_Str"));
      ovOverlay[romEntry.getInt("String_Node_Str")]=(byte)pokenum;
      writeOverlay(romEntry.getInt("String_Node_Str"),ovOverlay);
    }
    if (romEntry.getInt("String_Node_Str") > 0) {
      int baseOffset=romEntry.getInt("String_Node_Str");
      if (romEntry.romType == Type_HGSS) {
        byte[] ftData=readOverlay(romEntry.getInt("String_Node_Str"));
        for (int f=0; f < 7; f++) {
          int pokenum=statics.next().number;
          writeWord(ftData,baseOffset + 2 + f * 4,pokenum);
        }
        writeOverlay(romEntry.getInt("String_Node_Str"),ftData);
      }
 else {
        for (int f=0; f < 7; f++) {
          int pokenum=statics.next().number;
          writeWord(arm9,baseOffset + 2 + f * 4,pokenum);
        }
      }
    }
  }
 catch (  IOException e) {
    return false;
  }
  return true;
}