United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7151434 java -jar -XX crashes java launcher
JDK-7151434 : java -jar -XX crashes java launcher

Details
Type:
Bug
Submit Date:
2012-03-06
Status:
Closed
Updated Date:
2013-08-02
Project Name:
JDK
Resolved Date:
2012-05-18
Component:
tools
OS:
generic
Sub-Component:
launcher
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
8
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Duplicate:
Duplicate:
Duplicate:
Relates:

Sub Tasks

Description
The java launcher crashes in JLI_WildcardExpandClasspath when run with the (strange) command line "java -jar -XX"

$ /localhome/java/jdk-8-ea-bin-b28/bin/java -jar -XX
Segmentation fault

Linux stack trace:
$ gdb --args /localhome/java/jdk-8-ea-bin-b28/fastdebug/bin/java -jar -XX
(gdb) r
Starting program: /localhome/java/jdk-8-ea-bin-b28/fastdebug/bin/java -jar -XX
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
__strchr_sse2 () at ../sysdeps/x86_64/multiarch/../strchr.S:33
33	../sysdeps/x86_64/multiarch/../strchr.S: No such file or directory.
	in ../sysdeps/x86_64/multiarch/../strchr.S
(gdb) bt
#0  __strchr_sse2 () at ../sysdeps/x86_64/multiarch/../strchr.S:33
#1  0x00007ffff79b0e9f in JLI_WildcardExpandClasspath ()
   from /localhome/java/jdk-8-ea-bin-b28/fastdebug/bin/../jre/lib/amd64/jli/libjli.so
#2  0x00007ffff79ac8ac in SetClassPath ()
   from /localhome/java/jdk-8-ea-bin-b28/fastdebug/bin/../jre/lib/amd64/jli/libjli.so
#3  0x00007ffff79acdc6 in JLI_Launch ()
   from /localhome/java/jdk-8-ea-bin-b28/fastdebug/bin/../jre/lib/amd64/jli/libjli.so
#4  0x0000000000400676 in main ()

The crash reproduces on solaris-amd64 as well.

I can reproduce this on JDK7 b147 but not on JDK6u29 b11, so I guess this is something that was introduced in 7.

                                    

Comments
EVALUATION

ParseArguments in java.c will set  "what" (pwhat) to null as it interprets
the next value (jar name) as an argument since it is prefixed by a "-".
The JLI_WildcardExpandClasspath needs to have a null check.
                                     
2012-03-06



Hardware and Software, Engineered to Work Together