JDK-4823860 : Java2d causes hotspot crash when loading JPEG with signed jar files
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.2.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-02-25
  • Updated: 2003-02-26
  • Resolved: 2003-02-26
Related Reports
Duplicate :  
Description

Name: nt126004			Date: 02/25/2003


FULL PRODUCT VERSION :
On windows machines:

java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

On redhat machine:

java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build Blackdown-1.4.1-01)
Java HotSpot(TM) Client VM (build Blackdown-1.4.1-01, mixed mode)

FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

ADDITIONAL OPERATING SYSTEMS :
Microsoft Windows XP [Version 5.1.2600]
Windows 98 [Version 4.10.2222]
RedHat Linux 8.0, 2.4.18-24.8.0



EXTRA RELEVANT SYSTEM CONFIGURATION :
On the RedHat machine it is reproducible with Blackdown's
1.4.1 release. This probably means it happens with Sun's
release as well although I only tested with Sun's release on
Windows.

A DESCRIPTION OF THE PROBLEM :
When running code that loads a JPEG from a signed jar file
the application will just quit. It does not happen if the
file is a GIF or if it is a JPEG and the jar is unsigned.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Go to http://hera.csci.unt.edu/software/test/
2. Select the test.jnlp file. The jar file test.jar is
unsigned. Both buttons (Crash and Works) will work properly
and show the dialogs with the image.
3. Now select the test2.jnlp file. This jar file test2.jar
is signed. If you click on the Works button you will get a
dialog with the gif image. If you click on the Crash button
the program will crash.

The source code and images are all there if you need to
manipulate the test.

EXPECTED VERSUS ACTUAL BEHAVIOR :
It should have loaded the JPEG image and shown the dialog
normally whether signed or unsigned.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D2835EB
Function=JNI_OnLoad+0x249
Library=C:\Program Files\Java\j2re1.4.1_01\bin\jpeg.dll

Current Java thread:
	at sun.awt.image.JPEGImageDecoder.readImage(Native Method)
	at sun.awt.image.JPEGImageDecoder.produceImage(JPEGImageDecoder.java:144)
	at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:257)
	at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:168)
	at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)

Dynamic libraries:
0x00400000 - 0x00406000 	C:\Program Files\Java\j2re1.4.1_01\bin\javaw.exe
0x77F80000 - 0x77FFB000 	C:\WINNT\System32\ntdll.dll
0x77DB0000 - 0x77E0D000 	C:\WINNT\system32\ADVAPI32.dll
0x77E80000 - 0x77F36000 	C:\WINNT\system32\KERNEL32.DLL
0x77D30000 - 0x77DA1000 	C:\WINNT\system32\RPCRT4.DLL
0x77E10000 - 0x77E6F000 	C:\WINNT\system32\USER32.dll
0x77F40000 - 0x77F79000 	C:\WINNT\system32\GDI32.dll
0x78000000 - 0x78046000 	C:\WINNT\system32\MSVCRT.dll
0x10000000 - 0x10019000 	C:\WINNT\System32\NVDESK32.DLL
0x6D330000 - 0x6D45A000 	C:\Program Files\Java\j2re1.4.1_01\bin\client\jvm.dll
0x77570000 - 0x775A0000 	C:\WINNT\System32\WINMM.dll
0x6D1D0000 - 0x6D1D7000 	C:\Program Files\Java\j2re1.4.1_01\bin\hpi.dll
0x6D300000 - 0x6D30D000 	C:\Program Files\Java\j2re1.4.1_01\bin\verify.dll
0x6D210000 - 0x6D229000 	C:\Program Files\Java\j2re1.4.1_01\bin\java.dll
0x6D320000 - 0x6D32D000 	C:\Program Files\Java\j2re1.4.1_01\bin\zip.dll
0x0AC70000 - 0x0AC7A000 	C:\Program Files\Java Web Start\javawspl.dll
0x77A50000 - 0x77B45000 	C:\WINNT\system32\ole32.dll
0x782F0000 - 0x78536000 	C:\WINNT\system32\SHELL32.dll
0x70BD0000 - 0x70C34000 	C:\WINNT\system32\SHLWAPI.DLL
0x71780000 - 0x7180A000 	C:\WINNT\system32\COMCTL32.DLL
0x6D000000 - 0x6D0FB000 	C:\Program Files\Java\j2re1.4.1_01\bin\awt.dll
0x77800000 - 0x7781E000 	C:\WINNT\System32\WINSPOOL.DRV
0x76620000 - 0x76630000 	C:\WINNT\system32\MPR.DLL
0x75E60000 - 0x75E7A000 	C:\WINNT\System32\IMM32.dll
0x6D180000 - 0x6D1D0000 	C:\Program Files\Java\j2re1.4.1_01\bin\fontmanager.dll
0x72800000 - 0x72846000 	C:\WINNT\System32\ddraw.dll
0x728A0000 - 0x728A6000 	C:\WINNT\System32\DCIMAN32.dll
0x72D90000 - 0x72E03000 	C:\WINNT\System32\D3DIM.DLL
0x6D2D0000 - 0x6D2DE000 	C:\Program Files\Java\j2re1.4.1_01\bin\net.dll
0x75050000 - 0x75058000 	C:\WINNT\System32\WSOCK32.dll
0x75030000 - 0x75043000 	C:\WINNT\System32\WS2_32.DLL
0x75020000 - 0x75028000 	C:\WINNT\System32\WS2HELP.DLL
0x782C0000 - 0x782CC000 	C:\WINNT\System32\rnr20.dll
0x77980000 - 0x779A4000 	C:\WINNT\System32\DNSAPI.DLL
0x77340000 - 0x77353000 	C:\WINNT\System32\iphlpapi.dll
0x77520000 - 0x77525000 	C:\WINNT\System32\ICMP.DLL
0x77320000 - 0x77337000 	C:\WINNT\System32\MPRAPI.DLL
0x75150000 - 0x75160000 	C:\WINNT\System32\SAMLIB.DLL
0x75170000 - 0x751BF000 	C:\WINNT\System32\NETAPI32.DLL
0x77BE0000 - 0x77BEF000 	C:\WINNT\System32\SECUR32.DLL
0x751C0000 - 0x751C6000 	C:\WINNT\System32\NETRAP.DLL
0x77950000 - 0x7797A000 	C:\WINNT\system32\WLDAP32.DLL
0x779B0000 - 0x77A4B000 	C:\WINNT\system32\OLEAUT32.DLL
0x773B0000 - 0x773DE000 	C:\WINNT\System32\ACTIVEDS.DLL
0x77380000 - 0x773A2000 	C:\WINNT\System32\ADSLDPC.DLL
0x77830000 - 0x7783E000 	C:\WINNT\System32\RTUTILS.DLL
0x77880000 - 0x7790D000 	C:\WINNT\System32\SETUPAPI.DLL
0x77C10000 - 0x77C6D000 	C:\WINNT\System32\USERENV.DLL
0x774E0000 - 0x77512000 	C:\WINNT\System32\RASAPI32.DLL
0x774C0000 - 0x774D1000 	C:\WINNT\System32\RASMAN.DLL
0x77530000 - 0x77552000 	C:\WINNT\System32\TAPI32.DLL
0x77360000 - 0x77379000 	C:\WINNT\System32\DHCPCSVC.DLL
0x777E0000 - 0x777E8000 	C:\WINNT\System32\winrnr.dll
0x777F0000 - 0x777F5000 	C:\WINNT\System32\rasadhlp.dll
0x74FD0000 - 0x74FED000 	C:\WINNT\system32\msafd.dll
0x75010000 - 0x75017000 	C:\WINNT\System32\wshtcpip.dll
0x6D130000 - 0x6D152000 	C:\Program Files\Java\j2re1.4.1_01\bin\dcpr.dll
0x6D280000 - 0x6D29E000 	C:\Program Files\Java\j2re1.4.1_01\bin\jpeg.dll
0x77920000 - 0x77943000 	C:\WINNT\system32\imagehlp.dll
0x72A00000 - 0x72A2D000 	C:\WINNT\system32\DBGHELP.dll
0x690A0000 - 0x690AB000 	C:\WINNT\System32\PSAPI.DLL

Local Time = Wed Feb 19 08:08:57 2003
Elapsed Time = 120
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.1_01-b01 mixed mode)
#

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
package test;

import java.net.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
 * Simple program to show WebStart bug.
 */
public class TestFrame extends JFrame
{
	/**
	 * Create test frame.
	 */
	public TestFrame()
	{
		// Setup frame
		super("Test");
		setSize(200, 200);
		Container cp=getContentPane();
		cp.setLayout(new GridLayout(2, 1));
		final JFrame frame=this;
		
		// Add button to show dialog which crashes
		JButton b=new JButton("Crash");
		b.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				ImageDialog d=new ImageDialog(frame, "test/logo.jpg");
				d.pack();
				d.show();
			}
		});
		cp.add(b);
		
		// Works
		b=new JButton("Works");
		b.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				ImageDialog d=new ImageDialog(frame, "test/logo.gif");
				d.pack();
				d.show();
			}
		});
		cp.add(b);
		
		// Listen for window closing
		addWindowListener(new WindowAdapter()
		{
			public void windowClosing(WindowEvent e)
			{
				dispose();
				System.exit(0);
			}
		});
	}
	
	/**
	 * Entry point.
	 */
	public static void main(String[] args)
	{
		new TestFrame().show();
	}
	
	/**
	 * Get image resource. This is a convenience method for accessing images if
	 * the application is put in a jar file.
	 *
	 * @param name  name of file for image
	 * @return      object representing image or null if not found
	 */
	private Image getImage(String name)
	{
		ClassLoader loader=getClass().getClassLoader();
		URL url=loader.getResource(name);
		if(url==null)
			return null;
		else
			return Toolkit.getDefaultToolkit().getImage(url);
	}
	
	/**
	 * Component with image.
	 */
	private class ImageComponent extends JComponent
	{
		// Splash image
		private Image image;
		
		/**
		 * Create component.
		 */
		public ImageComponent(String name)
		{
			MediaTracker mt=new MediaTracker(this);
			image=getImage(name);
			mt.addImage(image, 0);
			try { mt.waitForID(0); } catch(Exception e)	{}
		}
		
		/**
		 * Get preferred size.
		 */
		public Dimension getPreferredSize()
		{
			return new Dimension(image.getWidth(this), image.getHeight(this));
		}
		
		/**
		 * Draw image.
		 */
		public void paint(Graphics g)
		{
			g.drawImage(image, 0, 0, image.getWidth(this),
				image.getHeight(this), this);
		}
	}
	
	/**
	 * Basic dialog.
	 */
	private class ImageDialog extends JDialog
	{
		public ImageDialog(JFrame parent, String name)
		{
			super(parent, "Test");
			getContentPane().add(new ImageComponent(name), BorderLayout.CENTER);
		}
	}
}

---------- END SOURCE ----------

CUSTOMER WORKAROUND :
Use GIF and possible PNG (I have not tested this) instead of
JPEG. Or you could just use unsigned jars.
(Review ID: 181516) 
======================================================================