You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/07/06 04:04:00 UTC

DO NOT REPLY [Bug 49557] New: index erro in the loop to get the env info in the proc.create function

https://issues.apache.org/bugzilla/show_bug.cgi?id=49557

           Summary: index erro in the loop to get the env info in the
                    proc.create function
           Product: Tomcat Native
           Version: 1.1.19
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Library
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: lanyuflying@gmail.com


line 232:s_env[i+1] = tcn_get_string(e, str);

this will crash the java vm for a violate access error.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 49557] index erro in the loop to get the env info in the proc.create function

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49557

jfclere <jf...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from jfclere <jf...@gmail.com> 2011-01-06 11:49:54 EST ---
What are you trying to do?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 49557] index erro in the loop to get the env info in the proc.create function

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49557

--- Comment #3 from Konstantin Kolinko <kn...@gmail.com> 2011-01-06 18:17:54 EST ---
Created an attachment (id=26464)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26464)
Patch for proc.c of native/1.1.x. (not tested)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 49557] index erro in the loop to get the env info in the proc.create function

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49557

Konstantin Kolinko <kn...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #2 from Konstantin Kolinko <kn...@gmail.com> 2011-01-06 18:15:41 EST ---
He tries to launch an external program with a Proc.create() call, I think.

I see two problems in the current implementation of Proc::create in proc.c of
native 1.1:

1)
    if (env)
        es = (*e)->GetArrayLength(e, args);
calculates the length of the "args" array, where "env" array is expected. I
think it is the actual cause of access violation error.

2)
            s_env[i+1] = tcn_get_string(e, str);
as OP noted, should be
            s_env[i] = tcn_get_string(e, str);

Note, that if the "[i+1]" in the code were correct, there is
        s_env[i++] = apr_psprintf(p, TCN_PARENT_IDE "=%d", getpid());
assignment later, that will overwrite the last env. variable value in that
case.


This is probably not an error:
I see a cycle of free() calls to clear calls for s_env values. I do not see a
free() call for the value assigned with
  s_env[i++] = apr_psprintf(p, TCN_PARENT_IDE "=%d", getpid());
Probably that is not needed, because it was allocated from a pool?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 49557] index erro in the loop to get the env info in the proc.create function

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49557

--- Comment #5 from jfclere <jf...@gmail.com> 2011-01-07 03:22:10 EST ---
the free() are needed as the tcn_get_string makes malloc().

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 49557] index erro in the loop to get the env info in the proc.create function

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49557

--- Comment #4 from Konstantin Kolinko <kn...@gmail.com> 2011-01-06 21:22:50 EST ---
*** Bug 49556 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 49557] index erro in the loop to get the env info in the proc.create function

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49557

jfclere <jf...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #6 from jfclere <jf...@gmail.com> 2011-01-07 03:28:39 EST ---
Fixed by r1056218

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org