Program: 61726
Project: 61726
Buggy source:
public static Map<String,Object> getTextRecordsAttributes(List<TEXTRECORD> list,List<Tag> tags){
  Map<String,Object> att=new HashMap<>();
  RECT textBounds=new RECT(Integer.MAX_VALUE,Integer.MIN_VALUE,Integer.MAX_VALUE,Integer.MIN_VALUE);
  FontTag font=null;
  int x=0;
  int y=0;
  int textHeight=12;
  int lineSpacing=0;
  double leading=0;
  double ascent=0;
  double descent=0;
  double lineDistance=0;
  List<SHAPE> glyphs=new ArrayList<>();
  boolean firstLine=true;
  double top=0;
  List<Integer> allLeftMargins=new ArrayList<>();
  List<Integer> allLetterSpacings=new ArrayList<>();
  FontMetrics fontMetrics;
  BufferedImage bi=new BufferedImage(1,1,BufferedImage.TYPE_INT_RGB);
  Graphics graphics=bi.getGraphics();
  Font aFont=null;
  int currentLeftMargin;
  for (int r=0; r < list.size(); r++) {
    TEXTRECORD rec=list.get(r);
    if (rec.styleFlagsHasFont) {
      for (      Tag t : tags) {
        if (t instanceof FontTag) {
          FontTag ft=(FontTag)t;
          if (ft.getFontId() == rec.fontId) {
            font=ft;
          }
        }
      }
      textHeight=rec.textHeight;
      glyphs=font.getGlyphShapeTable();
      if (!font.hasLayout()) {
        String fontName=FontTag.getFontNameWithFallback(font.getFontName());
        aFont=new Font(fontName,font.getFontStyle(),(int)(textHeight / SWF.unitDivisor));
        fontMetrics=graphics.getFontMetrics(aFont);
        LineMetrics lm=fontMetrics.getLineMetrics("String_Node_Str",graphics);
        ascent=lm.getAscent();
        descent=lm.getDescent();
        leading=lm.getLeading();
        lineDistance=ascent + descent;
      }
 else {
        leading=((double)font.getLeading() * textHeight / 1024.0 / font.getDivider() / SWF.unitDivisor);
        ascent=((double)font.getAscent() * textHeight / 1024.0 / font.getDivider() / SWF.unitDivisor);
        descent=((double)font.getDescent() * textHeight / 1024.0 / font.getDivider() / SWF.unitDivisor);
        lineDistance=ascent + descent;
      }
    }
    currentLeftMargin=0;
    if (rec.styleFlagsHasXOffset) {
      x=rec.xOffset;
      currentLeftMargin=x;
    }
    if (rec.styleFlagsHasYOffset) {
      if (!firstLine) {
        top+=lineDistance;
        int topint=(int)Math.round(SWF.unitDivisor * top);
        lineSpacing=rec.yOffset - topint;
        top+=lineSpacing / SWF.unitDivisor;
      }
 else {
        top=ascent - 2.0;
      }
      y=rec.yOffset;
    }
    firstLine=false;
    allLeftMargins.add(currentLeftMargin);
    int letterSpacing=0;
    for (int e=0; e < rec.glyphEntries.length; e++) {
      GLYPHENTRY entry=rec.glyphEntries[e];
      GLYPHENTRY nextEntry=null;
      if (e < rec.glyphEntries.length - 1) {
        nextEntry=rec.glyphEntries[e + 1];
      }
      RECT rect=SHAPERECORD.getBounds(glyphs.get(entry.glyphIndex).shapeRecords);
      rect.Xmax=(int)Math.round(((double)rect.Xmax * textHeight) / (font.getDivider() * 1024));
      rect.Xmin=(int)Math.round(((double)rect.Xmin * textHeight) / (font.getDivider() * 1024));
      rect.Ymax=(int)Math.round(((double)rect.Ymax * textHeight) / (font.getDivider() * 1024));
      rect.Ymin=(int)Math.round(((double)rect.Ymin * textHeight) / (font.getDivider() * 1024));
      updateRect(textBounds,x + rect.Xmin,y + rect.Ymin);
      updateRect(textBounds,x + rect.Xmax,y + rect.Ymax);
      int adv=entry.glyphAdvance;
      int defaultAdvance;
      if (font.hasLayout()) {
        int kerningAdjustment=0;
        if (nextEntry != null) {
          kerningAdjustment=font.getGlyphKerningAdjustment(entry.glyphIndex,nextEntry.glyphIndex);
        }
        defaultAdvance=(int)Math.round(textHeight * (font.getGlyphAdvance(entry.glyphIndex) + kerningAdjustment) / 1024.0);
      }
 else {
        defaultAdvance=(int)Math.round(SWF.unitDivisor * FontTag.getSystemFontAdvance(aFont,font.glyphToChar(entry.glyphIndex),nextEntry == null ? null : font.glyphToChar(nextEntry.glyphIndex)));
      }
      letterSpacing=adv - defaultAdvance;
      x+=adv / (font.getDivider());
    }
    allLetterSpacings.add(letterSpacing);
  }
  att.put("String_Node_Str",0);
  att.put("String_Node_Str",0);
  att.put("String_Node_Str",lineSpacing);
  att.put("String_Node_Str",textBounds);
  att.put("String_Node_Str",allLeftMargins);
  att.put("String_Node_Str",allLetterSpacings);
  return att;
}

Fixed version (ground truth):
public static Map<String,Object> getTextRecordsAttributes(List<TEXTRECORD> list,List<Tag> tags){
  Map<String,Object> att=new HashMap<>();
  RECT textBounds=new RECT(Integer.MAX_VALUE,Integer.MIN_VALUE,Integer.MAX_VALUE,Integer.MIN_VALUE);
  FontTag font=null;
  int x=0;
  int y=0;
  int textHeight=12;
  int lineSpacing=0;
  double leading=0;
  double ascent=0;
  double descent=0;
  double lineDistance=0;
  List<SHAPE> glyphs=new ArrayList<>();
  boolean firstLine=true;
  double top=0;
  List<Integer> allLeftMargins=new ArrayList<>();
  List<Integer> allLetterSpacings=new ArrayList<>();
  FontMetrics fontMetrics;
  BufferedImage bi=new BufferedImage(1,1,BufferedImage.TYPE_INT_RGB);
  Graphics graphics=bi.getGraphics();
  Font aFont=null;
  int currentLeftMargin;
  for (int r=0; r < list.size(); r++) {
    TEXTRECORD rec=list.get(r);
    if (rec.styleFlagsHasFont) {
      for (      Tag t : tags) {
        if (t instanceof FontTag) {
          FontTag ft=(FontTag)t;
          if (ft.getFontId() == rec.fontId) {
            font=ft;
          }
        }
      }
      textHeight=rec.textHeight;
      glyphs=font.getGlyphShapeTable();
      if (!font.hasLayout()) {
        String fontName=FontTag.getFontNameWithFallback(font.getFontName());
        aFont=new Font(fontName,font.getFontStyle(),(int)(textHeight / SWF.unitDivisor));
        fontMetrics=graphics.getFontMetrics(aFont);
        LineMetrics lm=fontMetrics.getLineMetrics("String_Node_Str",graphics);
        ascent=lm.getAscent();
        descent=lm.getDescent();
        leading=lm.getLeading();
        lineDistance=ascent + descent;
      }
 else {
        leading=((double)font.getLeading() * textHeight / 1024.0 / font.getDivider() / SWF.unitDivisor);
        ascent=((double)font.getAscent() * textHeight / 1024.0 / font.getDivider() / SWF.unitDivisor);
        descent=((double)font.getDescent() * textHeight / 1024.0 / font.getDivider() / SWF.unitDivisor);
        lineDistance=ascent + descent;
      }
    }
    currentLeftMargin=0;
    if (rec.styleFlagsHasXOffset) {
      x=rec.xOffset;
      currentLeftMargin=x;
    }
    if (rec.styleFlagsHasYOffset) {
      if (!firstLine) {
        top+=ascent + descent;
        int topint=(int)(Math.round(top) * SWF.unitDivisor);
        lineSpacing=rec.yOffset - topint;
        top+=lineSpacing / SWF.unitDivisor;
      }
 else {
        top=ascent;
      }
      y=rec.yOffset;
    }
    firstLine=false;
    allLeftMargins.add(currentLeftMargin);
    int letterSpacing=0;
    for (int e=0; e < rec.glyphEntries.length; e++) {
      GLYPHENTRY entry=rec.glyphEntries[e];
      GLYPHENTRY nextEntry=null;
      if (e < rec.glyphEntries.length - 1) {
        nextEntry=rec.glyphEntries[e + 1];
      }
      RECT rect=SHAPERECORD.getBounds(glyphs.get(entry.glyphIndex).shapeRecords);
      rect.Xmax=(int)Math.round(((double)rect.Xmax * textHeight) / (font.getDivider() * 1024));
      rect.Xmin=(int)Math.round(((double)rect.Xmin * textHeight) / (font.getDivider() * 1024));
      rect.Ymax=(int)Math.round(((double)rect.Ymax * textHeight) / (font.getDivider() * 1024));
      rect.Ymin=(int)Math.round(((double)rect.Ymin * textHeight) / (font.getDivider() * 1024));
      updateRect(textBounds,x + rect.Xmin,y + rect.Ymin);
      updateRect(textBounds,x + rect.Xmax,y + rect.Ymax);
      int adv=entry.glyphAdvance;
      int defaultAdvance;
      if (font.hasLayout()) {
        int kerningAdjustment=0;
        if (nextEntry != null) {
          kerningAdjustment=font.getGlyphKerningAdjustment(entry.glyphIndex,nextEntry.glyphIndex);
        }
        defaultAdvance=(int)Math.round(textHeight * (font.getGlyphAdvance(entry.glyphIndex) + kerningAdjustment) / 1024.0);
      }
 else {
        defaultAdvance=(int)Math.round(SWF.unitDivisor * FontTag.getSystemFontAdvance(aFont,font.glyphToChar(entry.glyphIndex),nextEntry == null ? null : font.glyphToChar(nextEntry.glyphIndex)));
      }
      letterSpacing=adv - defaultAdvance;
      x+=adv / (font.getDivider());
    }
    allLetterSpacings.add(letterSpacing);
  }
  att.put("String_Node_Str",0);
  att.put("String_Node_Str",0);
  att.put("String_Node_Str",lineSpacing);
  att.put("String_Node_Str",textBounds);
  att.put("String_Node_Str",allLeftMargins);
  att.put("String_Node_Str",allLetterSpacings);
  return att;
}