Skip to content

Conversation

akkartik
Copy link

@akkartik akkartik commented Feb 4, 2022

I believe struct erow requires the following invariant:

for (int i = 0; i < E.numrows; ++i)
  assert(E.row[i].idx == i);

This is important because erow.idx is used to index into E.row in various places. Incrementing idx can cause out of bounds access and memory corruption.

@akkartik
Copy link
Author

akkartik commented Feb 4, 2022

Interestingly, the snaptoken tutorial for kilo includes this fix (in step 183). That gives me some confidence that I'm on the right track.

akkartik added a commit to akkartik/teliva that referenced this pull request Feb 4, 2022
Submitted upstream at antirez/kilo#81.
@StrongerXi
Copy link

I noticed it as well, and took me a while to convince myself until I saw the tutorial, and your PR here:).

@antirez
Copy link
Owner

antirez commented Oct 1, 2024

A lot of people convinced, I should probably merge without looking at it? :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants