6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/classFileParser.hpp"
27 #include "classfile/classLoader.hpp"
28 #include "classfile/classLoaderData.inline.hpp"
29 #include "classfile/javaAssertions.hpp"
30 #include "classfile/javaClasses.hpp"
31 #include "classfile/javaClasses.inline.hpp"
32 #include "classfile/moduleEntry.hpp"
33 #include "classfile/modules.hpp"
34 #include "classfile/packageEntry.hpp"
35 #include "classfile/stringTable.hpp"
36 #include "classfile/symbolTable.hpp"
37 #include "classfile/systemDictionary.hpp"
38 #include "classfile/vmSymbols.hpp"
39 #include "logging/log.hpp"
40 #include "logging/logStream.hpp"
41 #include "memory/resourceArea.hpp"
42 #include "oops/instanceKlass.hpp"
43 #include "prims/jvm.h"
44 #include "runtime/arguments.hpp"
45 #include "runtime/handles.inline.hpp"
46 #include "runtime/javaCalls.hpp"
47 #include "runtime/reflection.hpp"
48 #include "utilities/stringUtils.hpp"
49 #include "utilities/utf8.hpp"
50
51 static bool verify_module_name(const char *module_name) {
52 if (module_name == NULL) return false;
53 int len = (int)strlen(module_name);
54 return (len > 0 && len <= Symbol::max_length());
55 }
56
57 bool Modules::verify_package_name(const char* package_name) {
58 if (package_name == NULL) return false;
59 int len = (int)strlen(package_name);
60 return (len > 0 && len <= Symbol::max_length() &&
61 UTF8::is_legal_utf8((const unsigned char *)package_name, len, false) &&
62 ClassFileParser::verify_unqualified_name(package_name, len,
63 ClassFileParser::LegalClass));
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "jvm.h"
27 #include "classfile/classFileParser.hpp"
28 #include "classfile/classLoader.hpp"
29 #include "classfile/classLoaderData.inline.hpp"
30 #include "classfile/javaAssertions.hpp"
31 #include "classfile/javaClasses.hpp"
32 #include "classfile/javaClasses.inline.hpp"
33 #include "classfile/moduleEntry.hpp"
34 #include "classfile/modules.hpp"
35 #include "classfile/packageEntry.hpp"
36 #include "classfile/stringTable.hpp"
37 #include "classfile/symbolTable.hpp"
38 #include "classfile/systemDictionary.hpp"
39 #include "classfile/vmSymbols.hpp"
40 #include "logging/log.hpp"
41 #include "logging/logStream.hpp"
42 #include "memory/resourceArea.hpp"
43 #include "oops/instanceKlass.hpp"
44 #include "runtime/arguments.hpp"
45 #include "runtime/handles.inline.hpp"
46 #include "runtime/javaCalls.hpp"
47 #include "runtime/reflection.hpp"
48 #include "utilities/stringUtils.hpp"
49 #include "utilities/utf8.hpp"
50
51 static bool verify_module_name(const char *module_name) {
52 if (module_name == NULL) return false;
53 int len = (int)strlen(module_name);
54 return (len > 0 && len <= Symbol::max_length());
55 }
56
57 bool Modules::verify_package_name(const char* package_name) {
58 if (package_name == NULL) return false;
59 int len = (int)strlen(package_name);
60 return (len > 0 && len <= Symbol::max_length() &&
61 UTF8::is_legal_utf8((const unsigned char *)package_name, len, false) &&
62 ClassFileParser::verify_unqualified_name(package_name, len,
63 ClassFileParser::LegalClass));
|