[Ikvm-commit] ikvm/runtime AssemblyClassLoader.cs, 1.64, 1.65 ClassLoaderWrapper.cs, 1.225, 1.226 J
Brought to you by:
jfrijters
|
From: Jeroen F. <jfr...@us...> - 2014-06-24 09:44:40
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv546/runtime Modified Files: AssemblyClassLoader.cs ClassLoaderWrapper.cs JavaException.cs Log Message: Bug fix. Only the bootstrap class loader is allowed to define classes in the java package. Index: JavaException.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/JavaException.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** JavaException.cs 23 Feb 2013 12:41:02 -0000 1.16 --- JavaException.cs 24 Jun 2014 09:44:37 -0000 1.17 *************** *** 1,4 **** /* ! Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Jeroen Frijters This software is provided 'as-is', without any express or implied --- 1,4 ---- /* ! Copyright (C) 2002-2014 Jeroen Frijters This software is provided 'as-is', without any express or implied *************** *** 217,218 **** --- 217,233 ---- #endif } + + sealed class SecurityException : RetargetableJavaException + { + internal SecurityException(string msg) + : base(msg) + { + } + + #if !STATIC_COMPILER && !FIRST_PASS && !STUB_GENERATOR + internal override Exception ToJava() + { + return new java.lang.SecurityException(Message); + } + #endif + } Index: ClassLoaderWrapper.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/ClassLoaderWrapper.cs,v retrieving revision 1.225 retrieving revision 1.226 diff -C2 -d -r1.225 -r1.226 *** ClassLoaderWrapper.cs 3 Jun 2014 12:42:19 -0000 1.225 --- ClassLoaderWrapper.cs 24 Jun 2014 09:44:37 -0000 1.226 *************** *** 354,357 **** --- 354,365 ---- #endif // !STATIC_COMPILER && !STUB_GENERATOR + protected virtual void CheckProhibitedPackage(string className) + { + if (className.StartsWith("java.", StringComparison.Ordinal)) + { + throw new SecurityException("Prohibited package name: " + className.Substring(0, className.LastIndexOf('.'))); + } + } + #if !STUB_GENERATOR internal TypeWrapper DefineClass(ClassFile f, ProtectionDomain protectionDomain) *************** *** 381,384 **** --- 389,393 ---- } #endif + CheckProhibitedPackage(f.Name); // check if the class already exists if we're an AssemblyClassLoader if(FindLoadedClassLazy(f.Name) != null) Index: AssemblyClassLoader.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/AssemblyClassLoader.cs,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** AssemblyClassLoader.cs 2 Jun 2014 13:25:40 -0000 1.64 --- AssemblyClassLoader.cs 24 Jun 2014 09:44:37 -0000 1.65 *************** *** 1309,1312 **** --- 1309,1316 ---- } + protected override void CheckProhibitedPackage(string className) + { + } + #if !FIRST_PASS && !STATIC_COMPILER && !STUB_GENERATOR internal override java.lang.ClassLoader GetJavaClassLoader() |