United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6548757 Crash in fontmanager.dll on windows-amd64
JDK-6548757 : Crash in fontmanager.dll on windows-amd64

Details
Type:
Bug
Submit Date:
2007-04-21
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
client-libs
OS:
windows_2003,windows_xp
Sub-Component:
2d
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u2,7
Fixed Versions:

Related Reports
Backport:
Duplicate:
Duplicate:

Sub Tasks

Description
Following testcase crashes on windows-amd64 with jdk7(b10,b11), jdk6u2 but doesn't with jdk6b98:

import javax.swing.JFrame;
import javax.swing.UIManager;

public class Test {

    public static void main(String[] args) {
        try {
            UIManager.setLookAndFeel(
                    UIManager.getSystemLookAndFeelClassName());
        } catch (Exception ex) {
            System.out.println("Unable to load native look and feel");
        }
        (new JFrame()).setVisible(true);
    }
}

Here is the stack trace from crash dump:

ntdll!ZwWaitForSingleObject+0xa
kernel32!WaitForSingleObjectEx+0x130
faultrep!InternalGenerateMinidumpEx+0x722
faultrep!InternalGenerateMinidump+0x10a
faultrep!InternalGenFullAndTriageMinidumps+0xfb
faultrep!ReportFaultDWM+0x731
faultrep!StartManifestReportImmediate+0x2c0
faultrep!ReportFault+0x3ca
kernel32!UnhandledExceptionFilter+0x629
fontmanager!__report_gsfailure+0xec [d:\srvrtm\base\tools\gs_support\umode\gs_report.c @136]
fontmanager!DifferentFamily+0xb9 [d:\export\java2d\j2se\src\windows\native\sun\font\fontpath.c @ 195]
fontmanager!EnumFontFacesInFamilyProcW+0x60 [d:\export\java2d\j2se\src\windows\native\sun\font\fontpath.c @ 217]
gdi32!EnumFontsInternalW+0x1e6
gdi32!EnumFontFamiliesExW+0x48
fontmanager!EnumFamilyNamesW+0x239 [d:\export\java2d\j2se\src\windows\native\sun\font\fontpath.c @ 341]
gdi32!EnumFontsInternalW+0x1e6
gdi32!EnumFontFamiliesExW+0x48
fontmanager!Java_sun_font_FontManager_populateFontFileNameMap+0x383 [d:\export\java2d\j2se\src\windows\native\sun\font\fontpath.c @ 604]
0x209fcc4
0x1fde7a8

                                    

Comments
EVALUATION

>fontmanager!DifferentFamily+0xb9
This function is new in 6u2 b01 and JDK7 b08. It was added in fixing 6517861
I am reasonably windows is trying to report a buffer overflow.
the gs_restore function looks to be associated with the newer
compiler used to build for x64.
But I see a silent exit on windows 2003 server x64, not a crash

I looked at the new code in 6u2 b01 and noticed in order to
do a check we need to copy a full name from one windows data
structure (ENUMLOGFONTEX.elfFullName) into a field used to
hold a face name in a different windows data structure
(LOGFONT.lfFaceName). It appears that the former has
a size of LF_FULLFACESIZE (64 chars) whereas the later has a size
of LF_FACESIZE (32 chars). Using "Bitstream Vera Mono Bold Oblique"
I was able to verify that this does cause problems with the
test case and with Font2DTest for both 32 bit XP
and 64bit Windows 2003 server x64. On 32 bit XP the mainfestation
is that the font is skipped. On 2004 x64 there is a silent exit.

The fix is simple. If the fullname is >=32 chars, skip the check.
This means that the intent of 6517861 is simply ignored for
fonts that have names > 32 in length but since it was designed
to identify cases where windows has family aliases and none
of those are likely to involve fonts of such name lengths this
should be fine.

The size limitations in GDI seem a bit short. Although I
don't have any examples of fonts with family names >=32 or
full names >=64 I don't see anything in the TrueType spec
which indicates such a limit. 
http://www.microsoft.com/typography/otspec/name.htm

Presumably windows either refuses to install such fonts
or truncates the length of their names.

I'll wait for verification from the submitter that he also has
fonts with long names in case there's something more going on.
                                     
2007-04-23
EVALUATION

Submitter confirms he has such fonts and the suggested fix resolves it.
                                     
2007-04-24



Hardware and Software, Engineered to Work Together