Bug of regex.c (1.8)


#1

e$BLZB<$G$9!#e(B

[ruby-list:42096] e$B$K4X$7$F$A$g$C$HD4$Y$F$_$^$7$?!#e(B

re_compile_pattern e$B$NCf$K$"$k%-%c%i%/%?%/%i%9$N=hM}$NItJ,$Ge(B

else {
  if (TRANSLATE_P()) c = (unsigned char)translate[c];
  if (had_mbchar == 0 && (!current_mbctype || !had_num_literal)) {
    SET_LIST_BIT(c);
    had_num_literal = 0;
  }
  else {
    set_list_bits(c, c, b);
  }
}

e$B$H$$$&$N$,$"$j$^$9$,!"%^%k%A%P%$%H$r9MN8$7$?=hM}$K$J$C$F$$$k$H$-!"e(B
c e$B$K$O%^%k%A%P%$%HJ8;z$N>l9g$K$O5c$-JL$l$K$J$C$?>uBV$G$O$J$/$Fe(B
High byte e$B$He(B low byte e$B$,e(B bitwise or
e$B$5$l$?>uBV$GMh$F$$$^$9e(B
(ShiftJISe$B$Ge(B’e$BCNe(B’e$B$J$ie(B 0x926d)e$B!#e(B

e$B$7$+$7!“e(BTRANLATE_Pe$B$G$OBP>]$,%^%k%A%P%$%HJ8;z$+$I$&$+$NH=Dj$r$7$F$$$J$$e(B
e$B$N$G!”%^%k%A%P%$%HJ8;z$r$=$N$^$^;H$C$F%F!<%V%k$r0z$$$F$7$^$C$F$$$^$9!#e(B
e$B7k2L!"$4$_$r;H$C$FJQ49$9$k$3$H$K$J$C$F$$$^$9!#e(B

e$B$H$j$"$($:%F!<%V%k$r0z$/A0$K%^%k%A%P%$%HJ8;z$+$I$&$+$rH=Dj$9$kI,MW$,e(B
e$B$"$k$N$G$O$J$$$G$7$g$&$+e(B?

— regex.c.1~ 2005-10-19 01:27:53.000000000 +0900
+++ regex.c 2006-04-24 17:57:07.028500000 +0900
@@ -1705,7 +1705,7 @@ re_compile_pattern(pattern, size, bufp)
goto range_retry;
}
else {

  • if (TRANSLATE_P()) c = (unsigned char)translate[c];
    
  • if (TRANSLATE_P() && c < 0x100) c = (unsigned char)translate[c];
    if (had_mbchar == 0 && (!current_mbctype || !had_num_literal)) {
      SET_LIST_BIT(c);
      had_num_literal = 0;

#2

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:28598] bug of regex.c (1.8)”
on Mon, 24 Apr 2006 18:10:40 +0900, KIMURA Koichi
removed_email_address@domain.invalid writes:

|[ruby-list:42096] e$B$K4X$7$F$A$g$C$HD4$Y$F$$^$7$?!#e(B
|
|re_compile_pattern e$B$NCf$K$"$k%-%c%i%/%?%/%i%9$N=hM}$NItJ,$Ge(B
|
| else {
| if (TRANSLATE_P()) c = (unsigned char)translate[c];
| if (had_mbchar == 0 && (!current_mbctype || !had_num_literal)) {
| SET_LIST_BIT©;
| had_num_literal = 0;
| }
| else {
| set_list_bits(c, c, b);
| }
| }
|
|e$B$H$$$&$N$,$"$j$^$9$,!"%^%k%A%P%$%H$r9MN8$7$?=hM}$K$J$C$F$$$k$H$-!“e(B
|c e$B$K$O%^%k%A%P%$%HJ8;z$N>l9g$K$O5c$-JL$l$K$J$C$?>uBV$G$O$J$/$Fe(B
|High byte e$B$He(B low byte e$B$,e(B bitwise or e$B$5$l$?>uBV$GMh$F$$$^$9e(B
|(ShiftJISe$B$Ge(B’e$BCNe(B’e$B$J$ie(B 0x926d)e$B!#e(B
|
|e$B$7$+$7!“e(BTRANLATE_Pe$B$G$OBP>]$,%^%k%A%P%$%HJ8;z$+$I$&$+$NH=Dj$r$7$F$$$J$$e(B
|e$B$N$G!”%^%k%A%P%$%HJ8;z$r$=$N$^$^;H$C$F%F!<%V%k$r0z$$$F$7$^$C$F$$$^$9!#e(B
|e$B7k2L!”$4$
$r;H$C$FJQ49$9$k$3$H$K$J$C$F$$$^$9!#e(B
|
|e$B$H$j$"$($:%F!<%V%k$r0z$/A0$K%^%k%A%P%$%HJ8;z$+$I$&$+$rH=Dj$9$kI,MW$,e(B
|e$B$"$k$N$G$O$J$$$G$7$g$&$+e(B?

e$B$=$N$h$&$G$9$M!#<h$j9~$_$^$9!#$"$j$,$H$&$4$6$$$^$7$?!#e(B