`split': negative string size (or size too big) (ArgumentError)

“e$B$”$$$&$($*e(B".force_encoding(“euc-jp”).split(//) e$B$He(B (EUC-JP
e$B$Ge(B) e$B9T$&$He(B negative string size e$B$H$J$j$^$9!#e(B

% ./ruby -ve ‘p “e$B$”$$$&$($*e(B".force_encoding(“euc-jp”).split(//)’
ruby 1.9.0 (2007-12-04 patchlevel 0) [i686-linux]
-e:1:in split': negative string size (or size too big) (ArgumentError) from -e:1:in

[email protected]$G$9!#e(B

At Tue, 4 Dec 2007 17:52:27 +0900,
Tanaka A. wrote in [ruby-dev:32452]:

“e$B$”$$$&$($*e(B".force_encoding(“euc-jp”).split(//) e$B$He(B (EUC-JP
e$B$Ge(B) e$B9T$&$He(B negative string size e$B$H$J$j$^$9!#e(B

% ./ruby -ve ‘p “e$B$”$$$&$($*e(B".force_encoding(“euc-jp”).split(//)’
ruby 1.9.0 (2007-12-04 patchlevel 0) [i686-linux]
-e:1:in split': negative string size (or size too big) (ArgumentError) from -e:1:in

rb_reg_search()e$B$,J8;zC10L$N0LCV$rJV$9$N$K!“e(Brb_str_split_m()e$B$G$Oe(B
bytee$B0LCV$H$7$F;H$C$F$$$k$?$a$G$9$M!#e(BBEG()e$B$de(BEND()e$B$be(Bbytee$B0LCV$N$^$^e(B
e$B$J$N$G!”%a%=%C%I$NLa$jCM$H$7$FJV$9$H$-$KJ8;z0LCV$KJQ49$9$k$h$&$Ke(B
e$B$7$?$[$&$,$$$$$N$G$O$J$$$G$7$g$&$+!#e(B

[email protected]$G$9!#e(B

At Tue, 4 Dec 2007 17:52:27 +0900,
Tanaka A. wrote in [ruby-dev:32452]:

“e$B$”$$$&$($*e(B".force_encoding(“euc-jp”).split(//) e$B$He(B (EUC-JP
e$B$Ge(B) e$B9T$&$He(B negative string size e$B$H$J$j$^$9!#e(B

% ./ruby -ve ‘p “e$B$”$$$&$($*e(B".force_encoding(“euc-jp”).split(//)’
ruby 1.9.0 (2007-12-04 patchlevel 0) [i686-linux]
-e:1:in split': negative string size (or size too big) (ArgumentError) from -e:1:in

rb_reg_search()e$B$,J8;zC10L$N0LCV$rJV$9$N$K!“e(Brb_str_split_m()e$B$G$Oe(B
bytee$B0LCV$H$7$F;H$C$F$$$k$?$a$G$9$M!#e(BBEG()e$B$de(BEND()e$B$be(Bbytee$B0LCV$N$^$^e(B
e$B$J$N$G!”%a%=%C%I$NLa$jCM$H$7$FJV$9$H$-$KJ8;z0LCV$KJQ49$9$k$h$&$Ke(B
e$B$7$?$[$&$,$$$$$N$G$O$J$$$G$7$g$&$+!#e(B

[email protected]$G$9!#e(B

At Tue, 4 Dec 2007 20:17:55 +0900,
Nobuyoshi N. wrote in [ruby-dev:32453]:

At Tue, 4 Dec 2007 17:52:27 +0900,
Tanaka A. wrote in [ruby-dev:32452]:

“e$B$”$$$&$($*e(B".force_encoding(“euc-jp”).split(//) e$B$He(B (EUC-JP
e$B$Ge(B) e$B9T$&$He(B negative string size e$B$H$J$j$^$9!#e(B

% ./ruby -ve ‘p “e$B$”$$$&$($*e(B".force_encoding(“euc-jp”).split(//)’
ruby 1.9.0 (2007-12-04 patchlevel 0) [i686-linux]
-e:1:in split': negative string size (or size too big) (ArgumentError) from -e:1:in

e$B$3$l0J30$K$b!“e(B
p “e$B$”$$$&$($*e(B”.partition(“e$B$&e(B”) #=> [“e$B$”$$e(B",
“e$B$&e(B”, “e$B$*e(B”]

-- encoding: shift_jis --

p “e$BI=<(e(B”.partition("\") #=> [“e$BI=e(B”, “\”, “”]

e$B$H$+$$$m$$$m$*$+$7$J$3$H$K$J$C$F$k$N$G!“e(Bbyte/char
offsete$B$N;H$$$oe(B
e$B$1$K4X$7$F$O$b$C$H8+D>$9I,MW$,$”$j$=$&$G$9!#e(B

rb_reg_search()e$B$,J8;zC10L$N0LCV$rJV$9$N$K!“e(Brb_str_split_m()e$B$G$Oe(B
bytee$B0LCV$H$7$F;H$C$F$$$k$?$a$G$9$M!#e(BBEG()e$B$de(BEND()e$B$be(Bbytee$B0LCV$N$^$^e(B
e$B$J$N$G!”%a%=%C%I$NLa$jCM$H$7$FJV$9$H$-$KJ8;z0LCV$KJQ49$9$k$h$&$Ke(B
e$B$7$?$[$&$,$$$$$N$G$O$J$$$G$7$g$&$+!#e(B

e$B$H$j$"$($:[email protected]$1!#e(B

Index: re.c

— re.c (resuult 14122)
+++ re.c (working copy)
@@ -865,5 +865,5 @@ rb_reg_search(VALUE re, VALUE str, int p
OBJ_INFECT(match, str);

  • return rb_str_sublen(RMATCH(match)->str, result);
  • return result;
    }

@@ -1836,10 +1836,10 @@ reg_operand(VALUE s, int check)
}

-static VALUE
+static long
rb_reg_match_pos(VALUE re, VALUE str, long pos)
{
if (NIL_P(str)) {
rb_backref_set(Qnil);

  • return Qnil;
  • return -1;
    }
    str = reg_operand(str, Qtrue);
    @@ -1848,5 +1848,5 @@ rb_reg_match_pos(VALUE re, VALUE str, lo
    pos += RSTRING_LEN(str);
    if (pos < 0) {
  • return Qnil;
  • return pos;
    }
    }
    @@ -1854,8 +1854,5 @@ rb_reg_match_pos(VALUE re, VALUE str, lo
    }
    pos = rb_reg_search(re, str, pos, 0);
  • if (pos < 0) {
  • return Qnil;
  • }
  • return LONG2FIX(pos);
  • return pos;
    }

@@ -1872,5 +1869,7 @@ VALUE
rb_reg_match(VALUE re, VALUE str)
{

  • return rb_reg_match_pos(re, str, 0);
  • long pos = rb_reg_match_pos(re, str, 0);
  • if (pos < 0) return Qnil;
  • return LONG2FIX(pos);
    }

@@ -1937,4 +1936,5 @@ rb_reg_match2(VALUE re)
return Qnil;
}

  • start = rb_str_sublen(line, start);
    return LONG2FIX(start);
    }
    @@ -1982,6 +1982,6 @@ rb_reg_match_m(int argc, VALUE *argv, VA
    }
  • result = rb_reg_match_pos(re, str, pos);
  • if (NIL_P(result)) {
  • pos = rb_reg_match_pos(re, str, pos);
  • if (pos < 0) {
    rb_backref_set(Qnil);
    return Qnil;

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:32472] Re: `split’: negative string size (or size
too big) (ArgumentError)”
on Dec.06,2007 20:36:28, [email protected] wrote:
| e$B$3$l0J30$K$b!“e(B
| p “e$B$”$$$&$($e(B".partition(“e$B$&e(B”) #=> [“e$B$”$$e(B", “e$B$&e(B”, "e$B$e(B"]
|
| # -
- encoding: shift_jis -
-
| p “e$BI=<(e(B”.partition(”\") #=> [“e$BI=e(B”, “\”, “”]
|
| e$B$H$+$$$m$$$m$*$+$7$J$3$H$K$J$C$F$k$N$G!“e(Bbyte/char offsete$B$N;H$$$oe(B
| e$B$1$K4X$7$F$O$b$C$H8+D>$9I,MW$,$”$j$=$&$G$9!#e(B

e$B$A$g$C$H%_%K%^%`:F8=%1!<%9$,:n$l$F$J$$$N$G$9$,!"<j85$G$Oe(B
String#sube$B$Ge(BSEGVe$B$b5/$-$F$$$^$9!#e(B

| > rb_reg_search()e$B$,J8;zC10L$N0LCV$rJV$9$N$K!“e(Brb_str_split_m()e$B$G$Oe(B
| > bytee$B0LCV$H$7$F;H$C$F$$$k$?$a$G$9$M!#e(BBEG()e$B$de(BEND()e$B$be(Bbytee$B0LCV$N$^$^e(B
| > e$B$J$N$G!”%a%=%C%I$NLa$jCM$H$7$FJV$9$H$-$KJ8;z0LCV$KJQ49$9$k$h$&$Ke(B
| > e$B$7$?$[$&$,$$$$$N$G$O$J$$$G$7$g$&$+!#e(B
|
| e$B$H$j$"$($:[email protected]$1!#e(B

e$B$3$N%Q%C%A$GLdBj$,2r7h$9$k$C$]$$$3$H$O3NG’$7$F$"$k$N$G$9$,!"e(B
e$BF~$i$J$$$s$G$7$g$&$+e(B?

e$B$=$l$G$O!#e(B

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

In message “Re: [ruby-dev:32500] Re: `split’: negative string size (or
size too big) (ArgumentError)”
on Mon, 10 Dec 2007 09:48:29 +0900, “U.Nakamura”
[email protected] writes:

|e$B$3$N%Q%C%A$GLdBj$,2r7h$9$k$C$]$$$3$H$O3NG’$7$F$"$k$N$G$9$,!"e(B
|e$BF~$i$J$$$s$G$7$g$&$+e(B?

e$BF~$l$F$/[email protected]$5$$!#e(B> [email protected]$5$se(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs