Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8259843: initialize dli_fname array before calling dll_address_to_lib…
…rary_name

Reviewed-by: lucy, dholmes
  • Loading branch information
MBaesken committed Jan 20, 2021
1 parent 52ed2aa commit 69f90b5fd4c66d80f0ce133a82e7674dea101e08
Showing with 11 additions and 5 deletions.
  1. +2 −1 src/hotspot/os/bsd/os_bsd.cpp
  2. +1 −0 src/hotspot/os/linux/os_linux.cpp
  3. +4 −2 src/hotspot/share/prims/nativeLookup.cpp
  4. +4 −2 src/hotspot/share/runtime/frame.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2021, 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
@@ -1557,6 +1557,7 @@ void os::jvm_path(char *buf, jint buflen) {
}

char dli_fname[MAXPATHLEN];
dli_fname[0] = '\0';
bool ret = dll_address_to_library_name(
CAST_FROM_FN_PTR(address, os::jvm_path),
dli_fname, sizeof(dli_fname), NULL);
@@ -2637,6 +2637,7 @@ void os::jvm_path(char *buf, jint buflen) {
}

char dli_fname[MAXPATHLEN];
dli_fname[0] = '\0';
bool ret = dll_address_to_library_name(
CAST_FROM_FN_PTR(address, os::jvm_path),
dli_fname, sizeof(dli_fname), NULL);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, 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
@@ -434,8 +434,10 @@ void* NativeLookup::dll_load(const methodHandle& method) {
address current_entry = method->native_function();

char dll_name[JVM_MAXPATHLEN];
dll_name[0] = '\0';
int offset;
if (os::dll_address_to_library_name(current_entry, dll_name, sizeof(dll_name), &offset)) {
bool ret = os::dll_address_to_library_name(current_entry, dll_name, sizeof(dll_name), &offset);
if (ret && dll_name[0] != '\0') {
char ebuf[32];
return os::dll_load(dll_name, ebuf, sizeof(ebuf));
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, 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
@@ -540,9 +540,11 @@ void frame::print_C_frame(outputStream* st, char* buf, int buflen, address pc) {
int offset;
bool found;

if (buf == NULL || buflen < 1) return;
// libname
buf[0] = '\0';
found = os::dll_address_to_library_name(pc, buf, buflen, &offset);
if (found) {
if (found && buf[0] != '\0') {
// skip directory names
const char *p1, *p2;
p1 = buf;

0 comments on commit 69f90b5

Please sign in to comment.