Program: 173334
Project: 173334
Buggy source:
/** 
 * Create a list of certificates that the company may sell, taking all rules taken into account. <br>Note: old code that provides for ownership of presidencies of other companies has been retained, but not tested. This code will be needed for 1841.
 * @return List of sellable certificates.
 */
public void setSellableCerts(){
  String compName;
  int price;
  int number;
  int maxShareToSell;
  PortfolioModel companyPortfolio=operatingCompany.getPortfolioModel();
  for (  PublicCompany company : companyManager.getAllPublicCompanies()) {
    if (!company.hasStarted())     continue;
    maxShareToSell=companyPortfolio.getShare(company);
    if (maxShareToSell == 0)     continue;
    maxShareToSell=Math.min(maxShareToSell,getGameParameterAsInt(GameDef.Parm.POOL_SHARE_LIMIT) - pool.getShare(company));
    if (maxShareToSell == 0)     continue;
    int[] shareCountPerUnit=new int[5];
    compName=company.getId();
    for (    PublicCertificate c : companyPortfolio.getCertificates(company)) {
      if (c.isPresidentShare()) {
        shareCountPerUnit[1]+=c.getShares();
      }
 else {
        ++shareCountPerUnit[c.getShares()];
      }
    }
    if (sellPrices.containsKey(compName)) {
      price=(sellPrices.get(compName)).getPrice();
    }
 else {
      price=company.getMarketPrice();
    }
    for (int shareSize=1; shareSize <= 4; shareSize++) {
      number=shareCountPerUnit[shareSize];
      if (number == 0)       continue;
      number=Math.min(number,maxShareToSell / (shareSize * company.getShareUnit()));
      if (number == 0)       continue;
      for (int i=1; i <= number; i++) {
        possibleActions.add(new SellShares(company,shareSize,i,price));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Create a list of certificates that the company may sell, taking all rules taken into account. <br>Note: old code that provides for ownership of presidencies of other companies has been retained, but not tested. This code will be needed for 1841.
 * @return List of sellable certificates.
 */
public void setSellableCerts(){
  int price;
  int number;
  int maxShareToSell;
  PortfolioModel companyPortfolio=operatingCompany.getPortfolioModel();
  for (  PublicCompany company : companyManager.getAllPublicCompanies()) {
    if (!company.hasStarted())     continue;
    maxShareToSell=companyPortfolio.getShare(company);
    if (maxShareToSell == 0)     continue;
    maxShareToSell=Math.min(maxShareToSell,getGameParameterAsInt(GameDef.Parm.POOL_SHARE_LIMIT) - pool.getShare(company));
    if (maxShareToSell == 0)     continue;
    int[] shareCountPerUnit=new int[5];
    for (    PublicCertificate c : companyPortfolio.getCertificates(company)) {
      if (c.isPresidentShare()) {
        shareCountPerUnit[1]+=c.getShares();
      }
 else {
        ++shareCountPerUnit[c.getShares()];
      }
    }
    if (sellPrices.containsKey(company)) {
      price=(sellPrices.get(company)).getPrice();
    }
 else {
      price=company.getMarketPrice();
    }
    for (int shareSize=1; shareSize <= 4; shareSize++) {
      number=shareCountPerUnit[shareSize];
      if (number == 0)       continue;
      number=Math.min(number,maxShareToSell / (shareSize * company.getShareUnit()));
      if (number == 0)       continue;
      for (int i=1; i <= number; i++) {
        possibleActions.add(new SellShares(company,shareSize,i,price));
      }
    }
  }
}