Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8275517: Off-by-one error in allocation #6018

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -46,7 +46,7 @@ static const char* allocate(oop string) {
const typeArrayOop value = java_lang_String::value(string);
if (value != nullptr) {
const int length = java_lang_String::utf8_length(string, value);
str = NEW_C_HEAP_ARRAY(char, length, mtServiceability);
str = NEW_C_HEAP_ARRAY(char, length + 1, mtServiceability);
java_lang_String::as_utf8_string(string, value, str, length + 1);
}
return str;
@@ -94,9 +94,7 @@ FinalizerEntry::FinalizerEntry(const InstanceKlass* ik) :
_total_finalizers_run(0) {}

FinalizerEntry::~FinalizerEntry() {
if (_codesource != nullptr) {
FREE_C_HEAP_ARRAY(char, _codesource);
}
FREE_C_HEAP_ARRAY(char, _codesource);
}

const InstanceKlass* FinalizerEntry::klass() const {