Skip to content

Commit

Permalink
[bug] /[\x{0}-X]/i doesn't match properly when UTF-16/32 is used.
Browse files Browse the repository at this point in the history
This bug occurs when a code range already includes \x{0} and adding
a new code range to it. We must also care about 0xffffffff.
  • Loading branch information
k-takata committed Nov 16, 2011
1 parent 13a5849 commit b5fec0b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions regparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1741,9 +1741,10 @@ add_code_range_to_buf(BBuf** pbuf, OnigCodePoint from, OnigCodePoint to)
bound = x;
}

for (high = low, bound = n; high < bound; ) {
high = (to == ~((OnigCodePoint )0)) ? n : low;
for (bound = n; high < bound; ) {
x = (high + bound) >> 1;
if (to >= data[x*2] - 1)
if (to + 1 >= data[x*2])
high = x + 1;
else
bound = x;
Expand Down

0 comments on commit b5fec0b

Please sign in to comment.