8204055: SIGSEGV in java -XX:
Reviewed-by: iklam, stuefe, ccheung
This commit is contained in:
parent
e042b06185
commit
8062baac83
src/hotspot/share/utilities
test/hotspot
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "utilities/debug.hpp"
|
||||
#include "utilities/stringUtils.hpp"
|
||||
|
||||
int StringUtils::replace_no_expand(char* string, const char* from, const char* to) {
|
||||
@ -43,9 +44,16 @@ int StringUtils::replace_no_expand(char* string, const char* from, const char* t
|
||||
}
|
||||
|
||||
double StringUtils::similarity(const char* str1, size_t len1, const char* str2, size_t len2) {
|
||||
size_t total = len1 + len2;
|
||||
assert(str1 != NULL && str2 != NULL, "sanity");
|
||||
|
||||
// filter out zero-length strings else we will underflow on len-1 below
|
||||
if (len1 == 0 || len2 == 0) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
size_t total = len1 + len2;
|
||||
size_t hit = 0;
|
||||
|
||||
for (size_t i = 0; i < len1 - 1; i++) {
|
||||
for (size_t j = 0; j < len2 - 1; j++) {
|
||||
if ((str1[i] == str2[j]) && (str1[i+1] == str2[j+1])) {
|
||||
|
@ -239,6 +239,7 @@ TEST_VM_F(LogConfigurationTest, invalid_configure_options) {
|
||||
EXPECT_FALSE(LogConfiguration::parse_command_line_arguments("all=invalid_level"));
|
||||
EXPECT_FALSE(LogConfiguration::parse_command_line_arguments("what=invalid"));
|
||||
EXPECT_FALSE(LogConfiguration::parse_command_line_arguments("all::invalid_decorator"));
|
||||
EXPECT_FALSE(LogConfiguration::parse_command_line_arguments("*"));
|
||||
}
|
||||
|
||||
// Test empty configuration options
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8006298
|
||||
* @bug 8006298 8204055
|
||||
* @summary Using an unrecognized VM option should print the name of the option
|
||||
* @library /test/lib
|
||||
* @modules java.base/jdk.internal.misc
|
||||
@ -35,11 +35,19 @@ import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class UnrecognizedVMOption {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:bogus_option", "-version");
|
||||
// Note: -XX by itself is an unrecognized launcher option, the :
|
||||
// must be present for it to be passed through as a VM option.
|
||||
String[] badOptions = {
|
||||
"", // empty option
|
||||
"bogus_option",
|
||||
};
|
||||
for (String option : badOptions) {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:" + option, "-version");
|
||||
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Unrecognized VM option 'bogus_option'");
|
||||
output.shouldHaveExitValue(1);
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Unrecognized VM option '" + option + "'");
|
||||
output.shouldHaveExitValue(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user