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
This commit is contained in:
Matthias Baesken 2024-05-21 08:11:08 +00:00
parent 414a7fdc5e
commit e529101ea3

View File

@ -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);
}