[#44925] [Backport93 - Backport #5702][Open] backport r33935 — Yusuke Endoh <mame@...>
19 messages
2011/12/03
[#44929] [Backport93 - Backport #5702] backport r33935
— Tomoyuki Chikanaga <nagachika00@...>
2011/12/05
[#44931] Re: [Backport93 - Backport #5702] backport r33935
— Yusuke Endoh <mame@...>
2011/12/05
GyRCMXNGIyRHJDkhIxsoQgoKGyRCJWwlUyVlITwkIiRqJCwkSCQmJDQkNiQkJF4kOSEjGyhCCgoK
[#44934] Re: [Backport93 - Backport #5702] backport r33935
— "NARUSE, Yui" <naruse@...>
2011/12/05
2011年12月5日12:39 Yusuke Endoh <[email protected]>:
[#44940] Re: [ruby-cvs:41134] naruse:r33956 (trunk): Comment out tests which fails with GDBM-DBM compat mode. — Tanaka Akira <akr@...>
2011/12/6 <[email protected]>:
9 messages
2011/12/05
[#44941] Re: [ruby-cvs:41134] naruse:r33956 (trunk): Comment out tests which fails with GDBM-DBM compat mode.
— KOSAKI Motohiro <kosaki.motohiro@...>
2011/12/05
2011年12月5日16:56 Tanaka Akira <[email protected]>:
[#44942] Re: [ruby-cvs:41134] naruse:r33956 (trunk): Comment out tests which fails with GDBM-DBM compat mode.
— KOSAKI Motohiro <kosaki.motohiro@...>
2011/12/05
> おかしいな。gdbmは勝手にcreateフラグを立ててしまうので当該2つの
[#44943] Re: [ruby-cvs:41134] naruse:r33956 (trunk): Comment out tests which fails with GDBM-DBM compat mode.
— KOSAKI Motohiro <kosaki.motohiro@...>
2011/12/05
> def test_s_open_no_create
[#44944] Re: [ruby-cvs:41134] naruse:r33956 (trunk): Comment out tests which fails with GDBM-DBM compat mode.
— Tanaka Akira <akr@...>
2011/12/05
2011年12月6日7:19 KOSAKI Motohiro <[email protected]>:
[#44946] Re: [ruby-cvs:41134] naruse:r33956 (trunk): Comment out tests which fails with GDBM-DBM compat mode.
— KOSAKI Motohiro <kosaki.motohiro@...>
2011/12/06
>> DBM::VERSIONは仕様が腐っていて 1)本物のdbmとリンクした場合は
[#44947] Re: [ruby-cvs:41134] naruse:r33956 (trunk): Comment out tests which fails with GDBM-DBM compat mode.
— Tanaka Akira <akr@...>
2011/12/06
2011年12月6日12:51 KOSAKI Motohiro <[email protected]>:
[#44950] [ruby-trunk - Bug #5725][Assigned] Coverage doesn't honor file path encodings — Shyouhei Urabe <shyouhei@...>
6 messages
2011/12/08
[#44951] [ruby-trunk - Bug #5728][Open] SystemExit.new(bool, message) — Akira Tanaka <akr@...>
6 messages
2011/12/08
[#44961] [ruby-trunk - Bug #5731][Open] enum_for を使うと method_missing にブロックが渡されない — Masahiro Tomita <tommy@...>
4 messages
2011/12/09
[#44963] [ruby-trunk - Bug #5738][Open] if false; BEGIN {}; end が syntax error になる — Sho Hashimoto <sho-h@...>
5 messages
2011/12/10
[#44974] githubへの移行 — Shugo Maeda <shugo@...>
前田です。
10 messages
2011/12/12
[#44985] [ruby-trunk - Bug #5757][Open] main threadがreadやselectで待っていると、^C でなかなか死なない — Yui NARUSE <naruse@...>
12 messages
2011/12/13
[#45002] [ruby-trunk - Bug #5768][Assigned] TestRequire#test_race_exceptionで競合するケースがまだある — Yui NARUSE <naruse@...>
8 messages
2011/12/17
[#45021] [ruby-trunk - Bug #5786][Open] LoadError: cannot load such file -- openssl — Kazuhiro NISHIYAMA <redmine@...>
11 messages
2011/12/21
[#45022] [ruby-trunk - Bug #5786] LoadError: cannot load such file -- openssl
— Kazuhiro NISHIYAMA <redmine@...>
2011/12/21
[#45030] [ruby-trunk - Bug #5790][Open] net/http の EOFError と Keep-Alive — Yui NARUSE <naruse@...>
3 messages
2011/12/22
[#45034] Re: [ruby-dev:44974] githubへの移行 — Daehyub Kim <lateau@...>
44Oi44Or44Gn44GZ44CCCuOCiOOBneOCguOBruOBp+OBmeOBjOOAgeWwkeOBl+awl+OBq+OBquOC
9 messages
2011/12/22
[#45035] Re: githubへの移行
— "NARUSE, Yui" <naruse@...>
2011/12/22
2011年12月22日23:55 Daehyub Kim <[email protected]>:
[#45036] Re: githubへの移行
— Narihiro Nakamura <authornari@...>
2011/12/22
nariです。
[#45038] Re: githubへの移行
— KOSAKI Motohiro <kosaki.motohiro@...>
2011/12/22
> 成瀬さんがおっしゃってるログですが、以下にわりと古めのWikiページがある
[#45039] Re: githubへの移行
— Urabe Shyouhei <shyouhei@...>
2011/12/23
On 2011年12月23日 02:20, KOSAKI Motohiro wrote:
[ruby-dev:45041] [ruby-trunk - Bug #5801] Enumerable#take_while の proc を外に出して使うと Segv
From:
satoshi shiba <shiba@...>
Date:
2011-12-23 08:45:21 UTC
List:
ruby-dev #45041
Issue #5801 has been updated by satoshi shiba.
Enumerable#grep なども同様の問題がありますね。
以下の再現コードで Segv を吐きます。
enum.c で、XX_i という形の関数の第二引数が C の
スタックへのポインタになってるやつは、全部同じ問題を
含んでいるのではないでしょうか。
# 再現コード
=begin
class A
include Enumerable
def each(&b)
$block = b
yield
end
end
puts A.new.grep(//)
100.times{$block.call}
=end
static VALUE
grep_i(VALUE i, VALUE args, int argc, VALUE *argv)
{
VALUE *arg = (VALUE *)args; /* arg は C のスタックを指す */
ENUM_WANT_SVALUE();
if (RTEST(rb_funcall(arg[0], id_eqq, 1, i))) {
rb_ary_push(arg[1], i);
}
return Qnil;
}
----------------------------------------
Bug #5801: Enumerable#take_while の proc を外に出して使うと Segv
https://bugs.ruby-lang.org/issues/5801
Author: satoshi shiba
Status: Open
Priority: Normal
Assignee:
Category:
Target version: 1.9.3
ruby -v: ruby 1.9.3p6 (2011-12-20 revision 34080) [i686-linux]
芝と申します。
下の再現コードのように、Enumerable#take_while の Proc を
外に出して使うと Segv が発生します。
# 再現コード
=begin
class A
include Enumerable
def each(&b)
$block = b
yield
end
end
puts A.new.take_while{true}
100.times{$block.call}
=end
$block には、take_while 内で使用する take_while_i (enum.c)
が C の Proc として入ります。この Proc を上の例のように
グローバル変数などに入れて、take_while の呼出し後に使用
すると Segv を吐きます。
原因はおそらく、enum_take_while と take_while_i で、
take_while の返り値である配列オブジェクトをポインタ経由で
渡していることではないでしょうか。
/* enum_take_while と take_while_i */
static VALUE
enum_take_while(VALUE obj)
{
VALUE ary;
RETURN_ENUMERATOR(obj, 0, 0);
ary = rb_ary_new();
rb_block_call(obj, id_each, 0, 0, take_while_i, (VALUE)&ary /* <= ココ */);
return ary;
}
static VALUE
take_while_i(VALUE i, VALUE *ary /* <= ココ */, int argc, VALUE *argv)
{
if (!RTEST(enum_yield(argc, argv))) rb_iter_break();
rb_ary_push(*ary /* <= ココ */, enum_values_pack(argc, argv));
return Qnil;
}
enum_take_while では rb_block_call を呼び出すときに &ary を
引数として渡していますが、ary は C のローカル変数であるため、
C のスタックを指すことになります。このため、take_while の
呼出し後にグローバル変数などに保持された Proc から take_while_i
が呼び出されると、*ary の値が書き換わってしまっていて Segv を
吐いているように見えます。
以下のパッチでこのバグが再現しないことは確認できました。
参考にしていただければ幸いです。
よろしくお願いいたします。
/* パッチ */
Index: enum.c
===================================================================
--- enum.c (revision 34107)
+++ enum.c (working copy)
@@ -2053,7 +2053,7 @@
take_while_i(VALUE i, VALUE *ary, int argc, VALUE *argv)
{
if (!RTEST(enum_yield(argc, argv))) rb_iter_break();
- rb_ary_push(*ary, enum_values_pack(argc, argv));
+ rb_ary_push((VALUE)ary, enum_values_pack(argc, argv));
return Qnil;
}
@@ -2079,7 +2079,7 @@
RETURN_ENUMERATOR(obj, 0, 0);
ary = rb_ary_new();
- rb_block_call(obj, id_each, 0, 0, take_while_i, (VALUE)&ary);
+ rb_block_call(obj, id_each, 0, 0, take_while_i, ary);
return ary;
}
--
http://redmine.ruby-lang.org