Author: gshimansky
Date: Thu Feb 8 08:48:40 2007
New Revision: 504950
URL: http://svn.apache.org/viewvc?view=rev&rev=504950
Log:
Applied HARMONY-3133 [drlvm][classloader] Add check of field and
method names for classfile of version lower than 49
DRLVM tests passed on Ubuntu6 x86, Windows 2003 server x86 and SuSE9
x86_64.
Classlib text passed on windows.
Modified:
harmony/enhanced/classlib/trunk/depends/libs/linux.x86/ (props
changed)
harmony/enhanced/classlib/trunk/depends/libs/linux.x86_64/
(props changed)
harmony/enhanced/classlib/trunk/make/build-native.xml
harmony/enhanced/classlib/trunk/modules/text/build.xml
harmony/enhanced/classlib/trunk/modules/text/src/main/native/text/unix/makefile
harmony/enhanced/classlib/trunk/modules/text/src/main/native/text/windows/makefile
harmony/enhanced/drlvm/trunk/build/make/components/vm/vmcore.xml
harmony/enhanced/drlvm/trunk/build/make/targets/cunit.test.xml
harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp
Propchange: harmony/enhanced/classlib/trunk/depends/libs/linux.x86/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Feb 8 08:48:40 2007
@@ -0,0 +1,2 @@
+libicuuc.so
+libicudata.so
Propchange: harmony/enhanced/classlib/trunk/depends/libs/linux.x86_64/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Feb 8 08:48:40 2007
@@ -0,0 +1,2 @@
+libicuuc.so
+libicudata.so
Modified: harmony/enhanced/classlib/trunk/make/build-native.xml
URL:
http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/make/build-native.xml?view=diff&rev=504950&r1=504949&r2=504950
==============================================================================
--- harmony/enhanced/classlib/trunk/make/build-native.xml (original)
+++ harmony/enhanced/classlib/trunk/make/build-native.xml Thu Feb 8
08:48:40 2007
@@ -154,6 +154,7 @@
<!-- =================================
target: overlay-oss
================================= -->
+ <property name="iculib.zip"
location="${depends.oss}/icu4c-3.4-harmony.zip" />
<target name="overlay-oss">
<ant dir="modules/luni" antfile="build.xml"
target="overlay-oss" />
@@ -161,8 +162,10 @@
<ant dir="modules/archive" antfile="build.xml"
target="overlay-oss" />
- <ant dir="modules/text" antfile="build.xml"
- target="overlay-oss" />
+ <mkdir dir="${hy.hdk}/include/icu4c/unicode" />
+ <unzip src="${iculib.zip}"
dest="${hy.hdk}/include/icu4c/unicode" />
+ <chmod dir="${hy.hdk}/include/icu4c/unicode" perm="ugo+r" />
+ <copy file="${hy.hdk}/include/icu4c/unicode/icuuc.lib"
todir="${native.lib.target}" overwrite="yes"/>
</target>
<!-- =================================
@@ -228,8 +231,7 @@
target="clean-overlay-oss" />
<ant dir="modules/archive" antfile="build.xml"
target="clean-overlay-oss" />
- <ant dir="modules/text" antfile="build.xml"
- target="clean-overlay-oss" />
+ <delete dir="${hy.hdk}/include/icu4c" quiet="true" />
</target>
</project>
Modified: harmony/enhanced/classlib/trunk/modules/text/build.xml
URL:
http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/build.xml?view=diff&rev=504950&r1=504949&r2=504950
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/build.xml (original)
+++ harmony/enhanced/classlib/trunk/modules/text/build.xml Thu Feb 8
08:48:40 2007
@@ -37,8 +37,6 @@
</or>
</fileset>
- <property name="iculib.zip"
location="${depends.oss}/icu4c-3.4-harmony.zip" />
-
<property name="text.exclude.file"
location="${hy.hdk}/build/text.exclude" />
<target name="build" depends="compile-java, copy-resources,
build-jar" />
@@ -56,16 +54,6 @@
<!-- internal target for local and global test run sequence -->
<target name="-test-module" depends="build, compile-tests,
prepare-exclude, run-tests" />
-
- <target name="overlay-oss">
- <mkdir dir="${hy.text.src.main.native}/icu4c/unicode" />
- <unzip src="${iculib.zip}"
dest="${hy.text.src.main.native}/icu4c/unicode" />
- <chmod dir="${hy.text.src.main.native}/icu4c/unicode"
perm="ugo+r" />
- </target>
-
- <target name="clean-overlay-oss">
- <delete dir="${hy.text.src.main.native}/icu4c" quiet="true" />
- </target>
<!-- Build native code -->
<target name="build-native" >
Modified:
harmony/enhanced/classlib/trunk/modules/text/src/main/native/text/unix/makefile
URL:
http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/main/native/text/unix/makefile?view=diff&rev=504950&r1=504949&r2=504950
==============================================================================
---
harmony/enhanced/classlib/trunk/modules/text/src/main/native/text/unix/makefile
(original)
+++
harmony/enhanced/classlib/trunk/modules/text/src/main/native/text/unix/makefile
Thu Feb 8 08:48:40 2007
@@ -20,7 +20,7 @@
include $(HY_HDK)/build/make/defines.mk
CFLAGS += -fpic
-INCLUDES += -I../../icu4c
+INCLUDES += -I$(HY_HDK)/include/icu4c
BUILDFILES = $(SHAREDSUB)text_copyright.o $(SHAREDSUB)BidiWrapper.o
Modified:
harmony/enhanced/classlib/trunk/modules/text/src/main/native/text/windows/makefile
URL:
http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/main/native/text/windows/makefile?view=diff&rev=504950&r1=504949&r2=504950
==============================================================================
---
harmony/enhanced/classlib/trunk/modules/text/src/main/native/text/windows/makefile
(original)
+++
harmony/enhanced/classlib/trunk/modules/text/src/main/native/text/windows/makefile
Thu Feb 8 08:48:40 2007
@@ -23,14 +23,14 @@
DLLNAME=..\$(LIBBASE).dll
LIBNAME=$(LIBPATH)$(LIBBASE).lib
HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
-HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I../../icu4c
+HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I$(HY_HDK)\include\icu4c
BUILDFILES = $(SHAREDSUB)text_copyright.obj $(SHAREDSUB)BidiWrapper.obj
VIRTFILES = hytext.res
SYSLIBFILES = ws2_32.lib Iphlpapi.lib
MDLLIBFILES = \
$(LIBPATH)hysig.lib $(LIBPATH)hycommon.lib $(LIBPATH)hypool.lib
$(LIBPATH)hyfdlibm.lib \
- $(LIBPATH)hythr.lib $(LIBPATH)vmi.lib ..\..\icu4c\unicode\icuuc.lib
+ $(LIBPATH)hythr.lib $(LIBPATH)vmi.lib $(LIBPATH)icuuc.lib
DLLBASE=0x13300000
COMMENT=/comment:"Text component native code. (c) Copyright 1991,
2005 The Apache Software Foundation or its licensors, as applicable."
Modified:
harmony/enhanced/drlvm/trunk/build/make/components/vm/vmcore.xml
URL:
http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/components/vm/vmcore.xml?view=diff&rev=504950&r1=504949&r2=504950
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/components/vm/vmcore.xml
(original)
+++ harmony/enhanced/drlvm/trunk/build/make/components/vm/vmcore.xml
Thu Feb 8 08:48:40 2007
@@ -57,6 +57,7 @@
<compiler id="c.compiler" extends="common.c.compiler">
<includepath>
<pathelement location="${build.vm.home}/include" />
+ <pathelement
location="${external.dep.CLASSLIB.includes}/icu4c" />
<pathelement location="${extra.apr.includes}/apr-1" />
<pathelement location="${extra.apr.includes}" />
<pathelement location="${extra.log4cxx.includes}" />
@@ -177,6 +178,7 @@
<pathelement location="${extra.apr.includes}" />
<pathelement location="${extra.apr.includes}/apr-1" />
<pathelement location="${extra.log4cxx.includes}" />
+ <pathelement
location="${external.dep.CLASSLIB.includes}/icu4c" />
<select os="win">
<pathelement location="${extra.zlib.includes}" />
</select>
@@ -188,7 +190,8 @@
<include name="vmcore/include" />
<include name="port/include" />
</dirset>
-
+
+ <pathelement path="${external.dep.CLASSLIB.includes}/icu4c" />
<pathelement path="${extra.log4cxx.includes}" />
<select os="win">
@@ -262,6 +265,21 @@
</fileset>
</select>
+ <select os="lnx" >
+ <select arch="ia32">
+ <symlink overwrite="yes"
link="${external.dep.CLASSLIB}/depends/libs/linux.x86/libicuuc.so"
+
resource="${external.dep.CLASSLIB}/depends/libs/linux.x86/libicuuc.so.34"/>
+ <symlink overwrite="yes"
link="${external.dep.CLASSLIB}/depends/libs/linux.x86/libicudata.so"
+
resource="${external.dep.CLASSLIB}/depends/libs/linux.x86/libicudata.so.34"/>
+ </select>
+ <select arch="em64t">
+ <symlink overwrite="yes"
link="${external.dep.CLASSLIB}/depends/libs/linux.x86_64/libicuuc.so"
+
resource="${external.dep.CLASSLIB}/depends/libs/linux.x86_64/libicuuc.so.34"/>
+ <symlink overwrite="yes"
link="${external.dep.CLASSLIB}/depends/libs/linux.x86_64/libicudata.so"
+
resource="${external.dep.CLASSLIB}/depends/libs/linux.x86_64/libicudata.so.34"/>
+ </select>
+ </select>
+
<linker id="linker" extends="common.linker">
<libset libs="${vm.port.lib}"
dir="${vm.port.libdir}" />
@@ -292,6 +310,9 @@
<select os="win">
<libset libs="${extra.zlib.lib}"
dir="${extra.zlib.libdir}" />
+
+ <libset libs="icuuc"
+ dir="${external.dep.CLASSLIB.libdir}"
/>
</select>
<select os="win" cfg="debug">
@@ -301,6 +322,14 @@
<select os="lnx">
<syslibset type="shared"
libs="m,dl,stdc++,z,xml2,pthread,gcc_s,rt" />
<linkerarg value="--export-dynamic" />
+ <select arch="ia32">
+ <libset type="shared" libs="icuuc"
+
dir="${external.dep.CLASSLIB}/depends/libs/linux.x86" />
+ </select>
+ <select arch="em64t">
+ <libset type="shared" libs="icuuc"
+
dir="${external.dep.CLASSLIB}/depends/libs/linux.x86_64" />
+ </select>
<!--linkerarg value="-lz" />
<linkerarg value="-lxml2" />
<linkerarg value="-lm" />
Modified: harmony/enhanced/drlvm/trunk/build/make/targets/cunit.test.xml
URL:
http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/make/targets/cunit.test.xml?view=diff&rev=504950&r1=504949&r2=504950
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/make/targets/cunit.test.xml
(original)
+++ harmony/enhanced/drlvm/trunk/build/make/targets/cunit.test.xml Thu
Feb 8 08:48:40 2007
@@ -138,12 +138,25 @@
<libset libs="hyzlib"
dir="${external.dep.CLASSLIB}/deploy/jdk/jre/bin" />
<libset libs="jthread"
dir="${build.semi.dir}/vm/jthread/_bin" />
<libset libs="harmonyvm"
dir="${build.semi.dir}/vm/vmcore/_bin" />
+ <libset libs="icuuc"
dir="${external.dep.CLASSLIB.libdir}" />
<select os="win">
<syslibset libs="advapi32, ws2_32,
mswsock, user32, userenv, odbc32" />
<linkerarg
value="/NODEFAULTLIB:libcmt.lib" />
</select>
<select os="lnx">
<syslibset type="shared" libs="stdc++,
gcc_s, pthread, rt" />
+ <select arch="ia32">
+ <libset type="shared" libs="icuuc"
+
dir="${external.dep.CLASSLIB}/depends/libs/linux.x86" />
+ <libset type="shared" libs="icudata"
+
dir="${external.dep.CLASSLIB}/depends/libs/linux.x86" />
+ </select>
+ <select arch="em64t">
+ <libset type="shared" libs="icuuc"
+
dir="${external.dep.CLASSLIB}/depends/libs/linux.x86_64" />
+ <libset type="shared" libs="icudata"
+
dir="${external.dep.CLASSLIB}/depends/libs/linux.x86_64" />
+ </select>
</select>
</linker>
</cc>
Modified:
harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp
URL:
http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp?view=diff&rev=504950&r1=504949&r2=504950
==============================================================================
---
harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp
(original)
+++
harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp
Thu Feb 8 08:48:40 2007
@@ -37,6 +37,8 @@
#include "interpreter_exports.h"
#include "jarfile_util.h"
+#include "unicode/uchar.h"
+
#ifdef _IPF_
#include "vm_ipf.h"
#endif //_IPF_
@@ -617,13 +619,25 @@
static inline bool
check_field_name(const char *name, unsigned len, bool old_version)
{
- for (unsigned i = 0; i < len; i++) {
- switch(name[i]){
- case '.':
- case ';':
- case '[':
- case '/':
- return false;
+ TRACE2("field", "field: " << name << " " << len)
+ if(old_version) {
+ TRACE2("field", "symbol: " << *name);
+ if(!(u_isalpha(*name) || *name == '$' || *name == '_'))
+ return false;
+ for (unsigned i = 1; i < len; i++) {
+ TRACE2("field", "symbol: " << name[i]);
+ if(!(u_isalnum(name[i]) || name[i] == '$' || name[i] ==
'_'))
+ return false;
+ }
+ }else {
+ for (unsigned i = 0; i < len; i++) {
+ switch(name[i]){
+ case '.':
+ case ';':
+ case '[':
+ case '/':
+ return false;
+ }
}
}
return true;
@@ -632,15 +646,25 @@
static inline bool
check_method_name(const char *name, unsigned len, bool old_version)
{
- for (unsigned i = 0; i < len; i++) {
- switch(name[i]){
- case '.':
- case ';':
- case '[':
- case '/':
- case '<':
- case '>':
+ if(old_version) {
+ if(!(u_isalpha(*name) || *name == '$' || *name == '_'))
return false;
+ for (unsigned i = 1; i < len; i++) {
+ TRACE2("field", "symbol: " << name[i]);
+ if(!(u_isalnum(name[i]) || name[i] == '$' || name[i] ==
'_'))
+ return false;
+ }
+ }else {
+ for (unsigned i = 0; i < len; i++) {
+ switch(name[i]){
+ case '.':
+ case ';':
+ case '[':
+ case '/':
+ case '<':
+ case '>':
+ return false;
+ }
}
}
return true;
@@ -722,7 +746,6 @@
{
if(!Class_Member::parse(clss, cfs))
return false;
-
if(env.verify_all
&& !check_field_name(_name->bytes, _name->len,
clss->get_version() < JAVA5_CLASS_FILE_VERSION))
@@ -2558,15 +2581,12 @@
if(tag == CONSTANT_Methodref)
{
//check method name
- if(name != env->Init_String)
+ if(env->verify_all && (name != env->Init_String)
+ && !check_method_name(name->bytes,name->len,
clss->get_version() < JAVA5_CLASS_FILE_VERSION))
{
- if(!check_method_name(name->bytes,name->len,
- clss->get_version() <
JAVA5_CLASS_FILE_VERSION))
- {
REPORT_FAILED_CLASS_CLASS(clss->get_class_loader(), clss,
"java/lang/ClassFormatError",
clss->get_name()->bytes << ": illegal
method name for CONSTANT_Methodref entry: " << name->bytes);
return false;
- }
}
//check method descriptor
if(!check_method_descriptor(descriptor->bytes))
@@ -2592,7 +2612,7 @@
if(tag == CONSTANT_Fieldref)
{
//check field name
- if(!check_field_name(name->bytes, name->len,
+ if(env->verify_all && !check_field_name(name->bytes,
name->len,
clss->get_version() < JAVA5_CLASS_FILE_VERSION))
{
REPORT_FAILED_CLASS_CLASS(clss->get_class_loader(), clss,
"java/lang/ClassFormatError",
@@ -2783,7 +2803,6 @@
"could not parse major version");
return false;
}
-
//See comment in specification 4.2 about supported versions.
if (!(m_version >= CLASSFILE_MAJOR
&& m_version <= CLASSFILE_MAJOR_MAX))