Skip to content

Commit

Permalink
make upstream kilo ASan-clean
Browse files Browse the repository at this point in the history
Many thanks to dirkf for antirez/kilo#73!

However, teliva is still not ASan-clean.
  • Loading branch information
akkartik committed Nov 25, 2021
1 parent 6727045 commit 05f4482
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/kilo.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,14 @@ static void editorUpdateSyntax(erow *row) {
/* Handle single-line comments. */
if (prev_sep && *p == scs[0] && *(p+1) == scs[1]) {
/* From here to end is a comment */
memset(row->hl+i,HL_COMMENT,row->size-i);
memset(row->hl+i,HL_COMMENT,row->rsize-i);
return;
}

/* Handle "" and '' */
if (in_string) {
row->hl[i] = HL_STRING;
if (*p == '\\') {
if (*p == '\\' && *(p+1)) {
row->hl[i+1] = HL_STRING;
p += 2; i += 2;
prev_sep = 0;
Expand Down Expand Up @@ -290,12 +290,13 @@ static void editorUpdateSyntax(erow *row) {
/* Handle keywords and lib calls */
if (prev_sep) {
int j;
int ileft = row->rsize-i;
for (j = 0; keywords[j]; j++) {
int klen = strlen(keywords[j]);
int kw2 = keywords[j][klen-1] == '|';
if (kw2) klen--;

if (!memcmp(p,keywords[j],klen) &&
if (klen < ileft && !memcmp(p,keywords[j],klen) &&
is_separator(*(p+klen)))
{
/* Keyword */
Expand Down

0 comments on commit 05f4482

Please sign in to comment.