United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7017324 Kerning crash in JDK 7 since ICU layout update
JDK-7017324 : Kerning crash in JDK 7 since ICU layout update

Details
Type:
Bug
Submit Date:
2011-02-04
Status:
Closed
Updated Date:
2011-04-13
Project Name:
JDK
Resolved Date:
2011-04-13
Component:
client-libs
OS:
windows_vista,generic
Sub-Component:
2d
CPU:
x86,generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Duplicate:

Sub Tasks

Description
The small program below crashes processing the 'kern' table since JDK 7 b123 ..

import java.io.*;
import java.awt.*;
import java.awt.font.*;
import java.util.*;

public class KernCrash extends Frame {
    private static Font font;

    public static void main(String[] args) throws Exception {
        HashMap attrs = new HashMap();
        attrs.put(TextAttribute.KERNING, TextAttribute.KERNING_ON);
        attrs.put(TextAttribute.SIZE, new Float(48f));
        font = Font.createFont(Font.TRUETYPE_FONT, new File("Vera.ttf"));
        font = font.deriveFont(attrs);
        System.out.println("using " + font);

        KernCrash f = new KernCrash();
        f.setTitle("Kerning Crash");
        f.setSize(600, 300);
        f.setForeground(Color.black);
        f.show();
    }

    public void paint(Graphics g) {
        Graphics2D g2 = (Graphics2D)g;
        FontRenderContext frc = g2.getFontRenderContext();
        TextLayout layout = new TextLayout("text", font, frc);
        layout.draw(g2, 10, 100);
    }
}

I've attached the Vera.ttf font and the full hs log but the
top of the native stack looks like this :

Stack: [0xd6b00000,0xd6b80000],  sp=0xd6b7e1d8,  free space=504k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libfontmanager.so+0x1744c]  void KernTable::process(LEGlyphStorage&)+0x90
C  [libfontmanager.so+0x22fac]  void LayoutEngine::adjustGlyphPositions(const unsigned short*,long,long,char,LEGlyphStorage&,LEErrorCode&)+0x1f0
C  [libfontmanager.so+0x233fc]  long LayoutEngine::layoutChars(const unsigned short*,long,long,long,char,float,float,LEErrorCode&)+0xf4
C  [libfontmanager.so+0x24a0c]  Java_sun_font_SunLayoutEngine_nativeLayout+0x1e8
j  sun.font.SunLayoutEngine.nativeLayout(Lsun/font/Font2D;Lsun/font/FontStrike;[FII[CIIIIIIILjava/awt/geom/Point2D$Float;Lsun/font/GlyphLayout$GVData;JJ)V+669586304
j  sun.font.SunLayoutEngine.nativeLayout(Lsun/font/Font2D;Lsun/font/FontStrike;[FII[CIIIIIIILjava/awt/geom/Point2D$Float;Lsun/font/GlyphLayout$GVData;JJ)V+0
j  sun.font.SunLayoutEngine.layout(Lsun/font/FontStrikeDesc;[FIILsun/font/TextRecord;ILjava/awt/geom/Point2D$Float;Lsun/font/GlyphLayout$GVData;)V+98
j  sun.font.GlyphLayout$EngineRecord.layout()V+95
j  sun.font.GlyphLayout.layout(Ljava/awt/Font;Ljava/awt/font/FontRenderContext;[CIIILsun/font/StandardGlyphVector;)Lsun/font/StandardGlyphVector;+541
j  sun.font.ExtendedTextSourceLabel.createGV()Lsun/font/StandardGlyphVector;+63
j  sun.font.ExtendedTextSourceLabel.getGV()Lsun/font/StandardGlyphVector;+9

-----

                                    

Comments
EVALUATION

Was able to confirm on b132
                                     
2011-03-05
SUGGESTED FIX

Kerning was actually broken, referencing off the end of the kerning table.
                                     
2011-03-06
SUGGESTED FIX

http://hg.openjdk.java.net/jdk7/jdk7/rev/9f88ef1d373f
                                     
2011-03-08
SUGGESTED FIX

http://hg.openjdk.java.net/jdk7/jdk7/rev/9f88ef1d373f
                                     
2011-03-08



Hardware and Software, Engineered to Work Together