Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix a typo when deleting a row #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

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:).

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.

None yet

2 participants