You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Geir Magnusson Jr (JIRA)" <ji...@apache.org> on 2006/10/24 20:38:20 UTC
[jira] Assigned: (HARMONY-1800) Harmony bug [classlib][drlvm] VM
crashes when started via Runtime.exec(...) with null in cmd or envp
elements
[ http://issues.apache.org/jira/browse/HARMONY-1800?page=all ]
Geir Magnusson Jr reassigned HARMONY-1800:
------------------------------------------
Assignee: Geir Magnusson Jr
> Harmony bug [classlib][drlvm] VM crashes when started via Runtime.exec(...) with null in cmd or envp elements
> -------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-1800
> URL: http://issues.apache.org/jira/browse/HARMONY-1800
> Project: Harmony
> Issue Type: Bug
> Components: DRLVM
> Environment: Windows and Linux
> Reporter: Vera Petrashkova
> Assigned To: Geir Magnusson Jr
> Attachments: H1800.jlR_impl.txt
>
>
> According to J2SE API specifications of java.lang.Runtime
> exec(String[] cmdarray)
> Throws:
> NullPointerException - If cmdarray is null, or one of the elements of cmdarray is null
> exec(String[] cmdarray, String[] envp)
> exec(String[] cmdarray, String [] envp, File dir)
> Throws:
> NullPointerException - If cmdarray is null, or one of the elements of cmdarray is null, or one of the elements of envp is null
> But, exec(...) do not throw NullPointerException when some element of cmdarray is null or one of the element
> of envp is null. Besides, started VM crashes.
> Code for reproducing:
> import junit.framework.TestCase;
> import java.io.*;
> public class testExec1 extends TestCase {
>
> public void testExec() {
> String [] cmdL = new String[5];
> cmdL[0] = System.getProperty("java.home")+File.separator+"bin"+File.separator+"java";
> cmdL[1] = "-classpath";
> cmdL[2] = ".";
> cmdL[3] = "testExec1_App";
> cmdL[4] = null;
> try {
> Process p = Runtime.getRuntime().exec(cmdL);
> p.waitFor();
> int ans = p.exitValue();
> InputStream is = p.getErrorStream();
> int toRead = is.available();
> byte[] out = new byte[100];
> int sz = 0;
> while (true) {
> int r = is.read();
> if (r == -1) {
> break;
> }
> out[sz] = (byte)r;
> sz++;
> if (sz == 100) {
> break;
> }
> }
> System.out.println("========Application error message======");
> System.out.println(new String (out, 0, sz));
> System.out.println("=======================================");
> fail("NullPointerException was not thrown. exitValue = " + ans);
> } catch (NullPointerException e) {
> } catch (Exception e) {
> e.printStackTrace();
> fail("Unexpected exception was thrown: " + e);
> }
> }
> }
> class testExec1_App {
> public static void main(String[] args) {
> System.out.println("-----------Ok----------");
> System.exit(0);
> }
> }
> Output on RI:
> ==================
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .
> Time: 0
> OK (1 test)
> Output on Harmony:
> ================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r453981, (Oct 9 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> ....VM Crashed!
> Windows reported exception: ACCESS_VIOLATION
> Registers:
> EAX: 0x00000000, EBX: 0x00000004, ECX: 0x006d6808, EDX=0x0013e600
> ESI: 0x00000400, EDI: 0x00000000, ESP: 0x0013e560, EBP=0x006d6bb8
> EIP: 0x005296f6
> Stack trace:
> 1: Java_java_lang_Runtime_00024SubProcess_createProcess0 (??:-1)
> 2: apr_day_snames (??:-1)
> <end of stack trace>
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r453981, (Oct 9 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> .========Application error message======
> SIGSEGV in VM code.
> Stack trace:
> 1: strlen (??:-1)
> 2: IP is 0x4113E77D <native code>
> 3: java/lang
> =======================================
> F
> Time: 0.325
> There was 1 failure:
> 1) testExec(testExec1)junit.framework.AssertionFailedError: NullPointerException was not thrown. exitValue = 129
> at testExec1.testExec(testExec1.java:35)
> at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>
> FAILURES!!!
> Tests run: 1, Failures: 1, Errors: 0
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira