Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-780

EXCEPTION_ACCESS_VIOLATION in fontmanager.so/fontmanager.dll

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.3.1
    • None
    • None
    • redhat linux rhel5 and windows xp

    Description

      It seems when writing a PDF that has an invalid embedded font to an image there is a crash in the native function sun.font.FileFont.getGlyphImage(JI). It can be reproduced using the PDFToImage program on a pdf with an invalid embedded font.

      Turing on -Dsun.java2d.debugfonts=true on a bad pdf will show some like the follow for the bad font

      INFO: open TTF: C:\DOCUME~1\mdavis\LOCALS~1\Temp+~JF4968602841241472406.tmp
      Jul 20, 2010 11:37:31 AM sun.font.TrueTypeGlyphMapper handleBadCMAP
      SEVERE: Null Cmap for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp+~JF4968602841241472406.tmpsubstituting for this font
      Jul 20, 2010 11:37:31 AM sun.font.FontManager deRegisterBadFont
      SEVERE: Deregister bad font: ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp+~JF4968602841241472406.tmp
      Jul 20, 2010 11:37:31 AM sun.font.FileFontStrike <init>
      INFO: Strike for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp+~JF4968602841241472406.tmp at size = 19 use natives = false useJavaRasteriser = true AAHint = 2 Has Embedded bitmaps = false

      The following code in PDSimpleFont.java seems to fix the crash although I am not sure if it is correct:

      public void drawString(String string, Graphics g, float fontSize, AffineTransform at, float x, float y) throws IOException {
      Font _awtFont = getawtFont();

      //mdavis - fix fontmanager.so/dll on sun.font.FileFont.getGlyphImage for font with bad cmaps?
      if (_awtFont.canDisplayUpTo(string) != -1)

      { log.warn("Changing fonts on <" + string + "> from <" + _awtFont.getName() + "> to default font"); _awtFont = null; }

      Graphics2D g2d = (Graphics2D) g;

      Attachments

        1. test.pdf
          316 kB
          Matt Davis

        Issue Links

          Activity

            People

              jukkaz Jukka Zitting
              davis.matt.t Matt Davis
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: