Fix incorrect null checks in 2 JVMTI functions
The functions GetThreadListStackTraces and GetOwnedMonitorInfo would
incorrectly fail to check all their arguments for null-pointers. This
could cause crashes if called with incorrect arguments.
Bug: 76204023
Test: ./test.py --host -j50
Change-Id: I0be69a63b9bbb0a6aaf1092fde725332ae3296e8
diff --git a/openjdkjvmti/ti_stack.cc b/openjdkjvmti/ti_stack.cc
index 373944f..b96374d 100644
--- a/openjdkjvmti/ti_stack.cc
+++ b/openjdkjvmti/ti_stack.cc
@@ -484,7 +484,7 @@
*stack_info_ptr = nullptr;
return ERR(NONE);
}
- if (stack_info_ptr == nullptr || stack_info_ptr == nullptr) {
+ if (thread_list == nullptr || stack_info_ptr == nullptr) {
return ERR(NULL_POINTER);
}
@@ -971,7 +971,7 @@
jthread thread,
jint* owned_monitor_count_ptr,
jobject** owned_monitors_ptr) {
- if (owned_monitors_ptr == nullptr || owned_monitors_ptr == nullptr) {
+ if (owned_monitor_count_ptr == nullptr || owned_monitors_ptr == nullptr) {
return ERR(NULL_POINTER);
}
auto handle_fun = [&] (art::ScopedObjectAccess& soa, MonitorVisitor& visitor)