Skip to content

Commit

Permalink
Merge pull request #418 from kevcadieux/shell-sort-fix
Browse files Browse the repository at this point in the history
Fixing heap-buffer-overflow error uncovered by ASan in the [Sort] test.
  • Loading branch information
liam-mitchell authored Jul 16, 2021
2 parents fad5471 + a3f459b commit b369a75
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/EASTL/sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ namespace eastl
{
iBack = iCurrent = iSorted;

for(iBack -= nSpace; (iCurrent != iInsertFirst) && compare(*iCurrent, *iBack); iCurrent = iBack, iBack -= nSpace)
for(; (iCurrent != iInsertFirst) && compare(*iCurrent, *(iBack -= nSpace)); iCurrent = iBack)
{
EASTL_VALIDATE_COMPARE(!compare(*iBack, *iCurrent)); // Validate that the compare function is sane.
eastl::iter_swap(iCurrent, iBack);
Expand Down

0 comments on commit b369a75

Please sign in to comment.