Program: 61781
Project: 61781
Buggy source:
/** 
 * Gets data bytes
 * @return Bytes of data
 */
@Override public byte[] getData(){
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  OutputStream os=baos;
  SWFOutputStream sos=new SWFOutputStream(os,getVersion());
  if (Configuration.debugCopy.get()) {
    sos=new SWFOutputStream(new CopyOutputStream(sos,new ByteArrayInputStream(data)),10);
  }
  try {
    sos.writeUI16(fontId);
    sos.writeUB(1,fontFlagsHasLayout ? 1 : 0);
    sos.writeUB(1,fontFlagsShiftJIS ? 1 : 0);
    sos.writeUB(1,fontFlagsSmallText ? 1 : 0);
    sos.writeUB(1,fontFlagsANSI ? 1 : 0);
    sos.writeUB(1,fontFlagsWideOffsets ? 1 : 0);
    sos.writeUB(1,fontFlagsWideCodes ? 1 : 0);
    sos.writeUB(1,fontFlagsItalic ? 1 : 0);
    sos.writeUB(1,fontFlagsBold ? 1 : 0);
    sos.writeLANGCODE(languageCode);
    byte[] fontNameBytes=Utf8Helper.getBytes(fontName);
    sos.writeUI8(fontNameBytes.length);
    sos.write(fontNameBytes);
    sos.writeUI16(numGlyphs);
    List<Long> offsetTable=new ArrayList<>();
    ByteArrayOutputStream baosGlyphShapes=new ByteArrayOutputStream();
    SWFOutputStream sos3=new SWFOutputStream(baosGlyphShapes,getVersion());
    for (int i=0; i < numGlyphs; i++) {
      offsetTable.add((glyphShapeTable.size() + 1) * (fontFlagsWideOffsets ? 4 : 2) + sos3.getPos());
      sos3.writeSHAPE(glyphShapeTable.get(i),1);
    }
    byte[] baGlyphShapes=baosGlyphShapes.toByteArray();
    for (    Long offset : offsetTable) {
      if (fontFlagsWideOffsets) {
        sos.writeUI32(offset);
      }
 else {
        sos.writeUI16((int)(long)offset);
      }
    }
    if (numGlyphs > 0) {
      long offset=(glyphShapeTable.size() + 1) * (fontFlagsWideOffsets ? 4 : 2) + baGlyphShapes.length;
      if (fontFlagsWideOffsets) {
        sos.writeUI32(offset);
      }
 else {
        sos.writeUI16((int)offset);
      }
      sos.write(baGlyphShapes);
      for (int i=0; i < numGlyphs; i++) {
        if (fontFlagsWideCodes) {
          sos.writeUI16(codeTable.get(i));
        }
 else {
          sos.writeUI8(codeTable.get(i));
        }
      }
    }
    if (fontFlagsHasLayout) {
      sos.writeSI16(fontAscent);
      sos.writeSI16(fontDescent);
      sos.writeSI16(fontLeading);
      for (int i=0; i < numGlyphs; i++) {
        sos.writeSI16(fontAdvanceTable.get(i));
      }
      for (int i=0; i < numGlyphs; i++) {
        sos.writeRECT(fontBoundsTable.get(i));
      }
      sos.writeUI16(fontKerningTable.length);
      for (int k=0; k < fontKerningTable.length; k++) {
        sos.writeKERNINGRECORD(fontKerningTable[k],fontFlagsWideCodes);
      }
    }
  }
 catch (  IOException e) {
  }
  return baos.toByteArray();
}

Fixed version (ground truth):
/** 
 * Gets data bytes
 * @return Bytes of data
 */
@Override public byte[] getData(){
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  OutputStream os=baos;
  SWFOutputStream sos=new SWFOutputStream(os,getVersion());
  if (Configuration.debugCopy.get()) {
    sos=new SWFOutputStream(new CopyOutputStream(sos,new ByteArrayInputStream(data)),10);
  }
  try {
    List<Long> offsetTable=new ArrayList<>();
    ByteArrayOutputStream baosGlyphShapes=new ByteArrayOutputStream();
    SWFOutputStream sos3=new SWFOutputStream(baosGlyphShapes,getVersion());
    for (int i=0; i < numGlyphs; i++) {
      offsetTable.add(sos3.getPos());
      sos3.writeSHAPE(glyphShapeTable.get(i),1);
    }
    byte[] baGlyphShapes=baosGlyphShapes.toByteArray();
    if (!fontFlagsWideOffsets && numGlyphs > 0) {
      long maxOffset=(glyphShapeTable.size() + 1) * 2 + baGlyphShapes.length;
      if (maxOffset > 65535) {
        fontFlagsWideOffsets=true;
      }
    }
    sos.writeUI16(fontId);
    sos.writeUB(1,fontFlagsHasLayout ? 1 : 0);
    sos.writeUB(1,fontFlagsShiftJIS ? 1 : 0);
    sos.writeUB(1,fontFlagsSmallText ? 1 : 0);
    sos.writeUB(1,fontFlagsANSI ? 1 : 0);
    sos.writeUB(1,fontFlagsWideOffsets ? 1 : 0);
    sos.writeUB(1,fontFlagsWideCodes ? 1 : 0);
    sos.writeUB(1,fontFlagsItalic ? 1 : 0);
    sos.writeUB(1,fontFlagsBold ? 1 : 0);
    sos.writeLANGCODE(languageCode);
    byte[] fontNameBytes=Utf8Helper.getBytes(fontName);
    sos.writeUI8(fontNameBytes.length);
    sos.write(fontNameBytes);
    sos.writeUI16(numGlyphs);
    for (    long offset : offsetTable) {
      long offset2=(glyphShapeTable.size() + 1) * (fontFlagsWideOffsets ? 4 : 2) + offset;
      if (fontFlagsWideOffsets) {
        sos.writeUI32(offset2);
      }
 else {
        sos.writeUI16((int)offset2);
      }
    }
    if (numGlyphs > 0) {
      long offset=(glyphShapeTable.size() + 1) * (fontFlagsWideOffsets ? 4 : 2) + baGlyphShapes.length;
      if (fontFlagsWideOffsets) {
        sos.writeUI32(offset);
      }
 else {
        sos.writeUI16((int)offset);
      }
      sos.write(baGlyphShapes);
      for (int i=0; i < numGlyphs; i++) {
        if (fontFlagsWideCodes) {
          sos.writeUI16(codeTable.get(i));
        }
 else {
          sos.writeUI8(codeTable.get(i));
        }
      }
    }
    if (fontFlagsHasLayout) {
      sos.writeSI16(fontAscent);
      sos.writeSI16(fontDescent);
      sos.writeSI16(fontLeading);
      for (int i=0; i < numGlyphs; i++) {
        sos.writeSI16(fontAdvanceTable.get(i));
      }
      for (int i=0; i < numGlyphs; i++) {
        sos.writeRECT(fontBoundsTable.get(i));
      }
      sos.writeUI16(fontKerningTable.length);
      for (int k=0; k < fontKerningTable.length; k++) {
        sos.writeKERNINGRECORD(fontKerningTable[k],fontFlagsWideCodes);
      }
    }
  }
 catch (  IOException e) {
  }
  return baos.toByteArray();
}