Skip to content

Commit

Permalink
regex.c: guard from spurious tolower vals
Browse files Browse the repository at this point in the history
  • Loading branch information
kyx0r committed Aug 18, 2023
1 parent 003b823 commit 4bfdf16
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions regex.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ static int compilecode(const char *re_loc, rcode *prog, int sizecode, int flg)
term = PC;
EMIT(PC++, CHAR);
uc_code(c, re)
if (flg & REG_ICASE)
c = tolower((unsigned char)c);
if (flg & REG_ICASE && (unsigned int)c < 128)
c = tolower(c);
EMIT(PC++, c);
break;
case '.':
Expand Down Expand Up @@ -110,14 +110,14 @@ static int compilecode(const char *re_loc, rcode *prog, int sizecode, int flg)
re++;
continue;
}
if (flg & REG_ICASE)
c = tolower((unsigned char)c);
if (flg & REG_ICASE && (unsigned int)c < 128)
c = tolower(c);
EMIT(PC++, c);
if (re[l] == '-' && re[l+1] != ']')
re += l+1;
uc_code(c, re)
if (flg & REG_ICASE)
c = tolower((unsigned char)c);
if (flg & REG_ICASE && (unsigned int)c < 128)
c = tolower(c);
EMIT(PC++, c);
uc_len(c, re) re += c;
}
Expand Down Expand Up @@ -544,7 +544,7 @@ int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp, int flg)
if (flg & REG_ICASE)
goto jmp_start1;
goto jmp_start2;
match(1, c = tolower((unsigned char)c);)
match(1, if ((unsigned int)c < 128) c = tolower(c);)
match(2, /*nop*/)
}

Expand Down

0 comments on commit 4bfdf16

Please sign in to comment.