Skip to content

Commit 89de98d

Browse files
committed
Exit early if no work would be done to avoid crashes
1 parent b383a5b commit 89de98d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/xss-common-keyvaluesort.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,9 @@ X86_SIMD_SORT_INLINE void xss_qsort_kv(
586586
half_vector<T2>,
587587
full_vector<T2>>::type;
588588

589+
// Exit early if no work would be done
590+
if (arrsize <= 1) return;
591+
589592
#ifdef XSS_TEST_KEYVALUE_BASE_CASE
590593
int maxiters = -1;
591594
bool minarrsize = true;
@@ -675,6 +678,9 @@ X86_SIMD_SORT_INLINE void xss_select_kv(T1 *keys,
675678
half_vector<T2>,
676679
full_vector<T2>>::type;
677680

681+
// Exit early if no work would be done
682+
if (arrsize <= 1) return;
683+
678684
#ifdef XSS_TEST_KEYVALUE_BASE_CASE
679685
int maxiters = -1;
680686
bool minarrsize = true;

0 commit comments

Comments
 (0)