antirez / kilo

A text editor in less than 1000 LOC with syntax highlight and search.
BSD 2-Clause "Simplified" License
7.41k stars 813 forks source link

"\t//" crashes kilo (sometimes!) #18

Open 1-p opened 8 years ago

1-p commented 8 years ago

to reproduce, start a new line, hit TAB, then / twice.

or hit / twice and then TAB at the beginning of the line.

Segmentation fault: 11

Seems like the while(*p) loop in editorUpdateSyntax has some bug.

https://github.com/antirez/kilo/blob/master/kilo.c#L401

practicalswift commented 8 years ago

@1-p Thanks for reporting! :-) Are you able to reproduce this? What platform are you using?

I'm unable to reproduce. I've tested under both Linux and OS X.

Ruk33 commented 8 years ago

I was able to reproduce it (Linux, Elementary OS). The PR solves it though.

Alykoff commented 8 years ago

It is reproducing for me too. OS X. Always.

1-p commented 8 years ago

@practicalswift Well, do it in a new line and enter \t//

It's due to a negative memset argument, as I said. And the PR I submitted fixed it. (changed a single char)