harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Varlamov (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HARMONY-5124) [drlvm][jitrino] Bugs in the implementation of Method_Table class
Date Fri, 23 Nov 2007 10:40:43 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-5124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Alexey Varlamov resolved HARMONY-5124.
--------------------------------------

    Resolution: Fixed
      Assignee: Alexey Varlamov

Fixed at revision: 597634, please verify.

Thanks for pointing this out; though this code is rather an "experimental research" facility
than production code, it deserves deeper review.


> [drlvm][jitrino] Bugs in the implementation of Method_Table class   
> --------------------------------------------------------------------
>
>                 Key: HARMONY-5124
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5124
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: li, shisheng
>            Assignee: Alexey Varlamov
>            Priority: Trivial
>
> the file is: working_vm\vm\jitrino\src\shared\methodtable.cpp
> in the implementation of member function *init*, there are some errors
> 1. parameter default_envvar is declared as a *const char* pointer, but used as normal
pointer, here is the code snippet 
> void Method_Table::init(const char *default_envvar, const char *envvarname)
> {
> ...
>     char *envvar = (char*)default_envvar;
> ...
>     if (envvar[0] == '"')
>         envvar ++;
>     if (envvar[strlen(envvar)-1] == '"') 
>         envvar[strlen(envvar)-1] = '\0';
> ...
> the problem is that default_envvar is changed into a normal char pointer and then may
be modified by the last statement. 
> the source of this parameter is from the ctor of this class 
> Method_Table::Method_Table(MemoryManager& memManager, 
>                            const char *default_envvar,
>                            const char *envvarname,
>                            bool accept_by_default): 
> 2. another problem of the above code snippet is that it does not check the boundary of
the string in the last two statements 
> image that if envvar contains only one character "\"", the double quote character, in
the last *if* statement, 
> strlen(envvar) will be 0, and strlen(envvar)-1 will be 0xffffffff (for 32-bit pointer)
because strlen() return unsigned value normally
> the following steps is about how to trigger out this error
> 1). add the following line in the opt.emconf (just under -XX:jit.CS_OPT.arg.optimizer.inline.pipeline=CS_OPT_inliner_pipeline)
> -XX:jit.CS_OPT.arg.optimizer.inline.skip_methods="
> 2). prepare a helloworld like this
> package helloworld;
> public class Main {
>     public static void main(String[] args) { 
>     }
> }
> 3). run java.exe like this
> working_vm\build\deploy\jdk\jre\bin\java.exe -Xem:working_vm\vm\jitrino\config\ia32\opt.emconf
 -jar helloworld.jar
> 4). at least on my machine, the vm launcher will crash, here is the desc. of my machine
> windows xp professional version 2002 SP2
> Pentium(R) 4CPU 3.00Ghz
> 2.99Ghz, 0.99GB of RAM
> 3. solution for such errors is simple, maybe simple code refactor 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message