Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4911127

Need to handle null scaler references for fonts.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 5.0
    • 5.0
    • client-libs
    • None
    • 2d
    • b28
    • generic
    • generic



      Name: inR10103 Date: 08/22/2003


        At the moment if we detect font invalidness after creation of Font object
      (e.g during decoding font content) then we release native scaler and
      set pointer to native scaler to nil.
        But java Font object will be alive ane its methods are accessible.
      Unfortunately implementation mostly do not check whether scaler exists
      and therefore seg. fault will likely to happen.

        Here is typical stacktrace:

      An unexpected exception has been detected in native code outside the VM.
      Unexpected Signal : 11 occurred at PC=0xFB8BF1F0
      Function=Java_sun_font_Type1Font_getMissingGlyphCode+0x4
      Library=/export2/nis/tiger.bae/build/solaris-sparc/lib/sparc/libfontmanager.so

      Current Java thread:
              at sun.font.Type1Font.getMissingGlyphCode(Native Method)
              at sun.font.Type1GlyphMapper.initMapper(Type1GlyphMapper.java:28)
              at sun.font.Type1GlyphMapper.<init>(Type1GlyphMapper.java:21)
              at sun.font.Type1Font.getMapper(Type1Font.java:384)
              at sun.font.FileFontStrike.<init>(FileFontStrike.java:101)
              at sun.font.FileFont.createStrike(FileFont.java:74)
              at sun.font.Font2D.getStrike(Font2D.java:323)
              at sun.font.Font2D.getStrike(Font2D.java:250)
              at sun.font.FontDesignMetrics.initMatrixAndMetrics(FontDesignMetrics.java:168)
              at sun.font.FontDesignMetrics.<init>(FontDesignMetrics.java:160)
              at sun.font.FontDesignMetrics.<init>(FontDesignMetrics.java:145)
              at sun.awt.SunToolkit.getFontMetrics(SunToolkit.java:401)
              at sun.awt.motif.MToolkit.getFontMetrics(MToolkit.java:357)
              at javax.swing.plaf.basic.BasicLabelUI.getPreferredSize(BasicLabelUI.java:213)
              at javax.swing.plaf.basic.BasicLabelUI.getMinimumSize(BasicLabelUI.java:239)
              at javax.swing.JComponent.getMinimumSize(JComponent.java:1361)
              at javax.swing.BoxLayout.checkRequests(BoxLayout.java:428)
              at javax.swing.BoxLayout.preferredLayoutSize(BoxLayout.java:246)
                 - locked <0xf38a4bb0> (a javax.swing.BoxLayout)
              at java.awt.Container.preferredSize(Container.java:1515)
                 - locked <0xf381c4a8> (a java.awt.Component$AWTTreeLock)
              at java.awt.Container.getPreferredSize(Container.java:1499)
              at javax.swing.JComponent.getPreferredSize(JComponent.java:1279)
              at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:769)
              at java.awt.Container.layout(Container.java:1357)
              at java.awt.Container.doLayout(Container.java:1347)
              at java.awt.Container.validateTree(Container.java:1429)
              at java.awt.Container.validateTree(Container.java:1436)
              at java.awt.Container.validateTree(Container.java:1436)
              at java.awt.Container.validateTree(Container.java:1436)
              at java.awt.Container.validateTree(Container.java:1436)
              at java.awt.Container.validate(Container.java:1404)
                 - locked <0xf381c4a8> (a java.awt.Component$AWTTreeLock)
              at java.awt.Window.show(Window.java:465)
              at FontAssert15.main(FontAssert15.java:13)

      Expected behavior - broken font should looks like dumb empty Font
      with default information about all broken parts (e.g. zero metrics,
      no glyps defined, etc.).

      NB: it is not enough to add pointer validity checks in scalerMethods.cpp.
      We also need take care of java side - NPE and other exceptions are
      not expected result. Probably we also need to provide support for
      missingGlyph if font is severe broken.

      BTW, at least some problems are valid for TrueType fonts too
      because they happen in shared code.

      ======================================================================

            prr Philip Race
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: