kilo icon indicating copy to clipboard operation
kilo copied to clipboard

fix a typo when deleting a row

Open akkartik opened this issue 2 years ago • 2 comments

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 avatar Feb 04 '22 01:02 akkartik

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 avatar Feb 04 '22 01:02 akkartik

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

StrongerXi avatar Mar 20 '22 16:03 StrongerXi