Skip to content

Commit 71ae327

Browse files
committed
fix invalid memory access (#14)
1 parent f5fc74a commit 71ae327

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

timsort.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,7 @@ template <typename RandomAccessIterator, typename LessFunction> class TimSort {
626626
if (len2 == 1) {
627627
assert(len1 > 0);
628628
dest -= len1;
629-
cursor1 -= len1;
630-
GFX_TIMSORT_MOVE_BACKWARD(cursor1 + 1, cursor1 + (1 + len1), dest + (1 + len1));
629+
GFX_TIMSORT_MOVE_BACKWARD(cursor1 + (1 - len1), cursor1 + 1, dest + (1 + len1));
631630
*dest = GFX_TIMSORT_MOVE(*cursor2);
632631
} else {
633632
assert(len2 != 0 && "Comparison function violates its general contract");

0 commit comments

Comments
 (0)