From e529101ea30b49a6601088ce5ab81df590fc52f0 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Tue, 21 May 2024 08:11:08 +0000 Subject: [PATCH] 8332473: ubsan: growableArray.hpp:290:10: runtime error: null pointer passed as argument 1, which is declared to never be null Reviewed-by: jsjolen, clanger --- src/hotspot/share/utilities/growableArray.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hotspot/share/utilities/growableArray.hpp b/src/hotspot/share/utilities/growableArray.hpp index 39118e38f5c..c3c64762942 100644 --- a/src/hotspot/share/utilities/growableArray.hpp +++ b/src/hotspot/share/utilities/growableArray.hpp @@ -287,10 +287,12 @@ public: } void sort(int f(E*, E*)) { + if (_data == nullptr) return; qsort(_data, length(), sizeof(E), (_sort_Fn)f); } // sort by fixed-stride sub arrays: void sort(int f(E*, E*), int stride) { + if (_data == nullptr) return; qsort(_data, length() / stride, sizeof(E) * stride, (_sort_Fn)f); }