[#24210] [SEGV] redefine Struct with same name — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
山本です。Struct を同じ名前で二度定義すると、
6 messages
2004/09/03
[#24213] 1.instance_eval "@@a" dumps core — Tanaka Akira <akr@...17n.org>
次のように、1.instance_eval "@@a" とすると core を吐きます。
10 messages
2004/09/03
[#24217] Re: 1.instance_eval "@@a" dumps core
— Yukihiro Matsumoto <matz@...>
2004/09/03
まつもと ゆきひろです
[#24218] Re: 1.instance_eval "@@a" dumps core
— Tanaka Akira <akr@...17n.org>
2004/09/04
In article <1094229200.559688.22218.nullmailer@picachu.netlab.jp>,
[#24219] Re: 1.instance_eval "@@a" dumps core
— Yukihiro Matsumoto <matz@...>
2004/09/05
まつもと ゆきひろです
[#24220] Re: 1.instance_eval "@@a" dumps core
— Tanaka Akira <akr@...17n.org>
2004/09/05
In article <1094342919.363209.2395.nullmailer@picachu.netlab.jp>,
[#24221] Re: 1.instance_eval "@@a" dumps core
— Yukihiro Matsumoto <matz@...>
2004/09/05
まつもと ゆきひろです
[#24231] system("") — Tanaka Akira <akr@...17n.org>
次のように、system("") が例外になるのは意図された挙動でしょうか?
6 messages
2004/09/06
[#24234] 要素代入での?!の扱いについて — Nowake <nowake@...>
野分です。
6 messages
2004/09/06
[#24255] ripper committed — Minero Aoki <aamine@...>
青木です。
11 messages
2004/09/12
[#24261] Array#collect! dumps core — Tanaka Akira <akr@...17n.org>
次のようにすると core を吐きます。
7 messages
2004/09/14
[#24277] new NKF2拡張ライブラリ — "Kenichi.Tamura" <sgs02516@...>
たむらです。
5 messages
2004/09/16
[#24287] Array#sort! with calcc dumps core — Tanaka Akira <akr@...17n.org>
次のようにすると core を吐きます。
6 messages
2004/09/19
[#24288] Re: Array#sort! with calcc dumps core
— Yukihiro Matsumoto <matz@...>
2004/09/19
まつもと ゆきひろです
[#24302] Procのブロック呼び出しメソッド名を自由に設定 — Nowake <nowake@...>
こんばんは、野分です。
8 messages
2004/09/21
[#24304] Re: Procのブロック呼び出しメソッド名を自由に設定
— Yukihiro Matsumoto <matz@...>
2004/09/22
まつもと ゆきひろです
[#24311] Array#sort! dumps core — Tanaka Akira <akr@...17n.org>
次のようにすると core を吐きます。
5 messages
2004/09/22
[#24315] String#sub! dumps core — Tanaka Akira <akr@...17n.org>
次のようにすると core を吐きます。
5 messages
2004/09/23
[#24332] Marshal.dump dumps core — Tanaka Akira <akr@...17n.org>
次のようにすると core を吐きます。
4 messages
2004/09/24
[#24337] Re: [ruby-cvs] ruby: * hash.c: iterator functions for hash_foreach() should return enum — nobu@...
なかだです。
4 messages
2004/09/24
[#24341] Array#* dumps core — Tanaka Akira <akr@...17n.org>
次のようにすると core を吐きます。
9 messages
2004/09/25
[#24351] Re: Array#* dumps core
— nobu@...
2004/09/27
なかだです。
[#24354] finalizer
— Tanaka Akira <akr@...17n.org>
2004/09/27
In article <200409270225.i8R2PDfs014206@sharui.nakada.niregi.kanuma.tochigi.jp>,
[#24368] Enumerable#sort_by dumps core — Tanaka Akira <akr@...17n.org>
次のようにすると core を吐きます。
4 messages
2004/09/28
[ruby-dev:24319] Re: String#sub! dumps core
From:
nobu@...
Date:
2004-09-23 09:45:31 UTC
List:
ruby-dev #24319
なかだです。
At Thu, 23 Sep 2004 13:02:00 +0900,
Tanaka Akira wrote in [ruby-dev:24315]:
> 次のようにすると core を吐きます。
>
> % ./ruby -e '
> s = "a" * 100
> s.sub!(/a*/) { s.clear; "b" * 100 }
> '
> -e:3: [BUG] Segmentation fault
> ruby 1.9.0 (2004-09-22) [i686-linux]
>
> zsh: abort (core dumped) ./ruby -e ' s = "a" * 100 s.sub!(/a*/) { s.clear; "b" * 100 } '
まだありそうでしょうか。
Index: string.c
===================================================================
RCS file: /cvs/ruby/src/ruby/string.c,v
retrieving revision 1.198
diff -U2 -p -d -r1.198 string.c
--- string.c 17 Sep 2004 09:24:12 -0000 1.198
+++ string.c 23 Sep 2004 09:43:41 -0000
@@ -1907,5 +1907,5 @@ rb_str_sub_bang(argc, argv, str)
int iter = 0;
int tainted = 0;
- long plen;
+ long plen, beg, end;
if (argc == 1 && rb_block_given_p()) {
@@ -1926,4 +1926,6 @@ rb_str_sub_bang(argc, argv, str)
match = rb_backref_get();
regs = RMATCH(match)->regs;
+ beg = BEG(0);
+ end = END(0);
if (iter) {
@@ -1931,4 +1933,8 @@ rb_str_sub_bang(argc, argv, str)
repl = rb_obj_as_string(rb_yield(rb_reg_nth_match(0, match)));
rb_backref_set(match);
+ if (END(0) > RSTRING(str)->len) {
+ end = RSTRING(str)->len;
+ if (beg > end) beg = end;
+ }
}
else {
@@ -1936,14 +1942,14 @@ rb_str_sub_bang(argc, argv, str)
}
if (OBJ_TAINTED(repl)) tainted = 1;
- plen = END(0) - BEG(0);
+ plen = end - beg;
if (RSTRING(repl)->len > plen) {
RESIZE_CAPA(str, RSTRING(str)->len + RSTRING(repl)->len - plen);
}
if (RSTRING(repl)->len != plen) {
- memmove(RSTRING(str)->ptr + BEG(0) + RSTRING(repl)->len,
- RSTRING(str)->ptr + BEG(0) + plen,
- RSTRING(str)->len - BEG(0) - plen);
+ memmove(RSTRING(str)->ptr + beg + RSTRING(repl)->len,
+ RSTRING(str)->ptr + end,
+ RSTRING(str)->len - end);
}
- memcpy(RSTRING(str)->ptr + BEG(0),
+ memcpy(RSTRING(str)->ptr + beg,
RSTRING(repl)->ptr, RSTRING(repl)->len);
RSTRING(str)->len += RSTRING(repl)->len - plen;
--
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
中田 伸悦