Bug #3127

Encoding#replicate(non_string)

Added by znz (Kazuhiro NISHIYAMA) about 2 years ago. Updated about 1 year ago.

[ruby-dev:40954]
Status:Closed Start date:04/11/2010
Priority:Normal Due date:
Assignee:- % Done:

100%

Category:core
Target version:1.9.2
ruby -v:ruby 1.9.2dev (2010-04-11 trunk 27297) [i686-linux]

Description

Encoding#replicate(name) に String 以外のオブジェクトを渡すと落ちます。

% ruby-trunk -e 'Encoding::UTF_8.replicate(0)'
-e:1: [BUG] Segmentation fault
ruby 1.9.2dev (2010-04-11 trunk 27297) [i686-linux]

-- control frame ----------
c:0004 p:---- s:0010 b:0010 l:000009 d:000009 CFUNC  :replicate
c:0003 p:0019 s:0006 b:0006 l:000344 d:0008ac EVAL   -e:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000344 d:000344 TOP
---------------------------
-- Ruby level backtrace information ----------------------------------------
-e:1:in `<main>'
-e:1:in `replicate'

-- C level backtrace information -------------------------------------------
/home/kazu/opt/ruby-trunk/lib/libruby.so.1.9(rb_vm_bugreport+0x72) [0xb7820102]
/home/kazu/opt/ruby-trunk/lib/libruby.so.1.9 [0xb771e45f]
/home/kazu/opt/ruby-trunk/lib/libruby.so.1.9(rb_bug+0x3a) [0xb771e4fa]
/home/kazu/opt/ruby-trunk/lib/libruby.so.1.9 [0xb77bbfe4]
[0xb7893410]
/home/kazu/opt/ruby-trunk/lib/libruby.so.1.9 [0xb780af83]
/home/kazu/opt/ruby-trunk/lib/libruby.so.1.9 [0xb7818f02]
/home/kazu/opt/ruby-trunk/lib/libruby.so.1.9 [0xb781085c]
/home/kazu/opt/ruby-trunk/lib/libruby.so.1.9 [0xb7816994]
/home/kazu/opt/ruby-trunk/lib/libruby.so.1.9(rb_iseq_eval_main+0xab) [0xb7816c6b]
/home/kazu/opt/ruby-trunk/lib/libruby.so.1.9 [0xb772123a]
/home/kazu/opt/ruby-trunk/lib/libruby.so.1.9(ruby_exec_node+0x25) [0xb7721275]
/home/kazu/opt/ruby-trunk/lib/libruby.so.1.9(ruby_run_node+0x35) [0xb7722875]
ruby-trunk(main+0x7e) [0x804886e]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0xb750bb56]
ruby-trunk [0x8048751]

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Associated revisions

Revision 27301
Added by nobu (Nobuyoshi Nakada) about 2 years ago

* encoding.c (enc_replicate): new encoding name must be valid c-string. [ruby-dev:40954]

History

Updated by nobu (Nobuyoshi Nakada) about 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
This issue was solved with changeset r27301.
Kazuhiro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

Also available in: Atom PDF