Skip to content

Fix #138 by doing a shift by 1.

Janek Kozicki requested to merge fix138shiftBy1 into fix138

I wanted to avoid this approach, because it is extremely easy to make a mistake in such modifications as these in this merge request. If you prefer this one, then we all have to check it three times ;)

As shown in !385 (closed) the problem is that on 32bit platforms j must be unsigned. And crash happens when having j=0; we do j--; and obtain 4294967295 instead of -1. And then j >= chunks[k] is true and we get crash when v[j] tries to access 4294967295th element:

while (j >= chunks[k] && v[j] > viInit) {
    ......
    j--;
}

@bchareyre please have a look. Currently InstertionSortCollider is broken in master. so we need to do the fix from either this MR or from the previous one !385 (closed), or something else.

Edited by Janek Kozicki

Merge request reports