Skip to content

Commit e529101

Browse files
committed
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
1 parent 414a7fd commit e529101

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/hotspot/share/utilities/growableArray.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,12 @@ class GrowableArrayView : public GrowableArrayBase {
287287
}
288288

289289
void sort(int f(E*, E*)) {
290+
if (_data == nullptr) return;
290291
qsort(_data, length(), sizeof(E), (_sort_Fn)f);
291292
}
292293
// sort by fixed-stride sub arrays:
293294
void sort(int f(E*, E*), int stride) {
295+
if (_data == nullptr) return;
294296
qsort(_data, length() / stride, sizeof(E) * stride, (_sort_Fn)f);
295297
}
296298

0 commit comments

Comments
 (0)