Program: 66529
Project: 66529
Buggy source:
protected void writeText(int type,String txt,IContent content,InlineFlag inlineFlag,IStyle computedStyle,IStyle inlineStyle){
  HyperlinkInfo hyper=getHyperlink(content);
  int paragraphWidth=(int)WordUtil.twipToPt(context.getCurrentWidth());
  boolean rtl=content.isDirectionRTL();
  if (content instanceof TextContent) {
    TextFlag textFlag=TextFlag.START;
    String fontFamily=null;
    if ("String_Node_Str".equals(txt) || txt == null || WordUtil.isField(content)) {
      if (computedStyle != null && computedStyle.getFontFamily() != null) {
        fontFamily=mapGenericFont(computedStyle.getFontFamily());
      }
      wordWriter.writeContent(type,txt,computedStyle,inlineStyle,fontFamily,hyper,inlineFlag,textFlag,paragraphWidth,rtl);
    }
 else {
      int level=rtl ? 1 : 0;
      BidiSplitter bidiSplitter=new BidiSplitter(new Chunk(txt,0,level,level));
      if (bidiSplitter.hasMore()) {
        do {
          Chunk ch=bidiSplitter.getNext();
          level=ch.getRunLevel();
          FontSplitter fontSplitter=getFontSplitter(content,ch.getText());
          while (fontSplitter.hasMore()) {
            ch=fontSplitter.getNext();
            wordWriter.writeContent(type,ch.getText(),computedStyle,inlineStyle,getFontFamily(computedStyle,ch),hyper,inlineFlag,textFlag,paragraphWidth,(level & 1) != 0 || !rtl && level > 0);
            textFlag=fontSplitter.hasMore() || bidiSplitter.hasMore() ? TextFlag.MIDDLE : TextFlag.END;
          }
        }
 while (bidiSplitter.hasMore());
      }
 else {
        FontSplitter fontSplitter=getFontSplitter(content,((TextContent)content).getText());
        while (fontSplitter.hasMore()) {
          Chunk ch=fontSplitter.getNext();
          int offset=ch.getOffset();
          int length=ch.getLength();
          fontFamily=getFontFamily(computedStyle,ch);
          String string=null;
          if (ch == Chunk.HARD_LINE_BREAK) {
            string=ch.getText();
          }
 else {
            string=txt.substring(offset,offset + length);
          }
          wordWriter.writeContent(type,string,computedStyle,inlineStyle,fontFamily,hyper,inlineFlag,textFlag,paragraphWidth,rtl);
          textFlag=fontSplitter.hasMore() ? TextFlag.MIDDLE : TextFlag.END;
        }
      }
    }
    if (inlineFlag == InlineFlag.BLOCK) {
      wordWriter.writeContent(type,null,computedStyle,inlineStyle,fontFamily,hyper,inlineFlag,TextFlag.END,paragraphWidth,rtl);
    }
  }
 else {
    wordWriter.writeContent(type,txt,computedStyle,inlineStyle,computedStyle.getFontFamily(),hyper,inlineFlag,TextFlag.WHOLE,paragraphWidth,rtl);
  }
}

Fixed version (ground truth):
protected void writeText(int type,String txt,IContent content,InlineFlag inlineFlag,IStyle computedStyle,IStyle inlineStyle){
  HyperlinkInfo hyper=getHyperlink(content);
  int paragraphWidth=(int)WordUtil.twipToPt(context.getCurrentWidth());
  boolean rtl=content.isDirectionRTL();
  if (content instanceof TextContent) {
    TextFlag textFlag=TextFlag.START;
    String fontFamily=null;
    if ("String_Node_Str".equals(txt) || txt == null || WordUtil.isField(content)) {
      if (computedStyle != null && computedStyle.getFontFamily() != null) {
        fontFamily=mapGenericFont(computedStyle.getFontFamily());
      }
      wordWriter.writeContent(type,txt,computedStyle,inlineStyle,fontFamily,hyper,inlineFlag,textFlag,paragraphWidth,rtl);
    }
 else {
      int level=rtl ? 1 : 0;
      BidiSplitter bidiSplitter=new BidiSplitter(new Chunk(txt,0,level,level));
      if (bidiSplitter.hasMore()) {
        do {
          Chunk ch=bidiSplitter.getNext();
          level=ch.getRunLevel();
          FontSplitter fontSplitter=getFontSplitter(content,ch.getText());
          while (fontSplitter.hasMore()) {
            ch=fontSplitter.getNext();
            wordWriter.writeContent(type,ch.getText(),computedStyle,inlineStyle,getFontFamily(computedStyle,ch),hyper,inlineFlag,textFlag,paragraphWidth,(level & 1) != 0 || !rtl && level > 0);
            textFlag=fontSplitter.hasMore() || bidiSplitter.hasMore() ? TextFlag.MIDDLE : TextFlag.END;
          }
        }
 while (bidiSplitter.hasMore());
      }
 else {
        FontSplitter fontSplitter=getFontSplitter(content,((TextContent)content).getText());
        while (fontSplitter.hasMore()) {
          Chunk ch=fontSplitter.getNext();
          int offset=ch.getOffset();
          int length=ch.getLength();
          fontFamily=getFontFamily(computedStyle,ch);
          String string=null;
          if (ch instanceof LineBreakChunk) {
            string=ch.getText();
          }
 else {
            string=txt.substring(offset,offset + length);
          }
          wordWriter.writeContent(type,string,computedStyle,inlineStyle,fontFamily,hyper,inlineFlag,textFlag,paragraphWidth,rtl);
          textFlag=fontSplitter.hasMore() ? TextFlag.MIDDLE : TextFlag.END;
        }
      }
    }
    if (inlineFlag == InlineFlag.BLOCK) {
      wordWriter.writeContent(type,null,computedStyle,inlineStyle,fontFamily,hyper,inlineFlag,TextFlag.END,paragraphWidth,rtl);
    }
  }
 else {
    wordWriter.writeContent(type,txt,computedStyle,inlineStyle,computedStyle.getFontFamily(),hyper,inlineFlag,TextFlag.WHOLE,paragraphWidth,rtl);
  }
}