/\p{Hiragana}/s may dump core when sizeof(int) differs from sizeof(long)

e$B1sF#$G$9!#e(B

sizeof(int) e$B$He(B sizeof(long) e$B$,0[$J$k4D6-$G@55,I=8=$Ne(B
property name e$B$re(B
e$B;H$&$HMn$A$k$3$H$,$"$k$h$&$G$9!#e(B

$ ./ruby -ve ‘/\p{Hiragana}/s’
ruby 1.9.0 (2008-06-16 revision 17363) [sparc-solaris2.9]
e$B%P%9%(%i!<e(B (core dumped)

enc/shift_jis.c e$B$Ne(B property_name_to_ctype e$B$Ge(B

297 int ctype;
298
299 PROPERTY_LIST_INIT_CHECK;
300
301 if (onig_st_lookup_strend(PropertyNameTable, p, end,
(void*)&ctype) == 0) {

e$B$H$7$F$$$F!"e(Bctype e$B$Oe(B int (4 bit) e$B$J$N$Ke(B st_data_t (8
bit) e$B$H$7$Fe(B
e$B=q$-9~$^$l$k$?$a$N$h$&$G$9!#e(B

e$B0J2<$N%Q%C%A$N$h$&$K!“e(Bonig_st_lookup_strend e$B$9$k$H$3$m$@$1e(B
ctype e$B$Ne(B
e$B7?$re(B long
e$B$K$9$l$P$3$NLdBj$OD>$j$^$7$?$,!”$3$l$G$$$$$N$G$7$g$&$+!#e(B

Index: enc/euc_jp.c

— enc/euc_jp.c (revision 17164)
+++ enc/euc_jp.c (working copy)
@@ -285,7 +285,7 @@
static int
property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
{

  • int ctype;
  • long ctype;

    PROPERTY_LIST_INIT_CHECK;

Index: enc/shift_jis.c

— enc/shift_jis.c (revision 17164)
+++ enc/shift_jis.c (working copy)
@@ -294,7 +294,7 @@
static int
property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
{

  • int ctype;
  • long ctype;

    PROPERTY_LIST_INIT_CHECK;

Index: enc/unicode.c

— enc/unicode.c (revision 17164)
+++ enc/unicode.c (working copy)
@@ -10817,7 +10817,8 @@
extern int
onigenc_unicode_property_name_to_ctype(OnigEncoding enc, UChar* name,
UChar* end)
{

  • int len, ctype;
  • int len;
  • long ctype;
    UChar buf[PROPERTY_NAME_MAX_SIZE];
    UChar *p;
    OnigCodePoint code;

e$B$J$+$@$G$9!#e(B

At Tue, 17 Jun 2008 08:04:08 +0900,
Yukihiro M. wrote in [ruby-dev:35134]:

|sizeof(int) e$B$He(B sizeof(long) e$B$,0[$J$k4D6-$G@55,I=8=$Ne(B property name e$B$re(B
|e$B;H$&$HMn$A$k$3$H$,$"$k$h$&$G$9!#e(B

|e$B0J2<$N%Q%C%A$N$h$&$K!“e(Bonig_st_lookup_strend e$B$9$k$H$3$m$@$1e(B ctype e$B$Ne(B
|e$B7?$re(B long e$B$K$9$l$P$3$NLdBj$OD>$j$^$7$?$,!”$3$l$G$$$$$N$G$7$g$&$+!#e(B

longe$B$G$O!"e(Bsizeof(void*) >
sizeof(long)e$B$N4D6-$GM>7W$J$H$3$m$^$GGKe(B
e$B2u$7$F$7$^$$$^$9!#e(Bst_data_te$B$r;H$&$Y$-$G$7$g$&!#e(B

e$B$$$$$s$8$c$J$$$G$7$g$&$+!#%3%_%C%H$7$F$/$@$5$$!#e(B
e$BB>$KF1<o$NLdBj$,$J$$$+5$$K$J$k$H$3$m$G$9$,!#e(B

gcc
-Walle$B$G%3%s%Q%$%k$9$l$P!“e(Bst_data_te$B$HBg$-$5$N0[$J$k@0?t$r;H$Ce(B
e$B$F$$$k$H$3$m$G$O7Y9p$,=P$k$O$:$G$9$,!”$3$3$G$O$o$6$o$6e(B(void
*)e$B$Ge(B
e$B1#$7$F$7$^$C$F$$$k$N$,LdBj$G$9!#e(B

e$B1sF#$G$9!#e(B

2008/06/17 10:16 Nobuyoshi N. [email protected]:

|e$B0J2<$N%Q%C%A$N$h$&$K!“e(Bonig_st_lookup_strend e$B$9$k$H$3$m$@$1e(B ctype e$B$Ne(B
|e$B7?$re(B long e$B$K$9$l$P$3$NLdBj$OD>$j$^$7$?$,!”$3$l$G$$$$$N$G$7$g$&$+!#e(B

longe$B$G$O!"e(Bsizeof(void*) > sizeof(long)e$B$N4D6-$GM>7W$J$H$3$m$^$GGKe(B
e$B2u$7$F$7$^$$$^$9!#e(Bst_data_te$B$r;H$&$Y$-$G$7$g$&!#e(B

e$B$"!"3N$+$K$=$&$G$9$M!#$=$N$h$&$K$7$F%3%_%C%H$7$^$7$?!#e(B

gcc -Walle$B$G%3%s%Q%$%k$9$l$P!“e(Bst_data_te$B$HBg$-$5$N0[$J$k@0?t$r;H$Ce(B
e$B$F$$$k$H$3$m$G$O7Y9p$,=P$k$O$:$G$9$,!”$3$3$G$O$o$6$o$6e(B(void *)e$B$Ge(B
e$B1#$7$F$7$^$C$F$$$k$N$,LdBj$G$9!#e(B

e$B:#99$G$9$,!"0l1~$3$N%-%c%9%H$b$O$:$7$F$*$-$^$7$?!#e(B

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

In message “Re: [ruby-dev:35131] /\p{Hiragana}/s may dump core when
sizeof(int) differs from sizeof(long)”
on Tue, 17 Jun 2008 01:04:44 +0900, “Yusuke ENDOH” [email protected]
writes:

|sizeof(int) e$B$He(B sizeof(long) e$B$,0[$J$k4D6-$G@55,I=8=$Ne(B property name e$B$re(B
|e$B;H$&$HMn$A$k$3$H$,$"$k$h$&$G$9!#e(B

|e$B0J2<$N%Q%C%A$N$h$&$K!“e(Bonig_st_lookup_strend e$B$9$k$H$3$m$@$1e(B ctype e$B$Ne(B
|e$B7?$re(B long e$B$K$9$l$P$3$NLdBj$OD>$j$^$7$?$,!”$3$l$G$$$$$N$G$7$g$&$+!#e(B

e$B$$$$$s$8$c$J$$$G$7$g$&$+!#%3%_%C%H$7$F$/$@$5$$!#e(B
e$BB>$KF1<o$NLdBj$,$J$$$+5$$K$J$k$H$3$m$G$9$,!#e(B