tanoku/redcarpet — Issue #99: Redcarpet::Markdown.new(renderer, [ :option ]) causes segfault
Author: aspiers
Created: 2012-01-13 00:26:14+00:00
State: open

I misread the docs and tried passing options to the constructor as an array rather than a hash, and to my surprise found Ruby dumping core every single time. This is with redcarpet 2.0.1 gem. I suspect it might be a Ruby bug, in which case we might need to report it upstream.

```
$ ruby -rredcarpet -e 'Redcarpet::Markdown.new(Redcarpet::Render::HTML, [ :hard_wrap ])'
-e:1: [BUG] Segmentation fault
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]

-- Control frame information -----------------------------------------------
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :new
c:0003 p:0030 s:0006 b:0006 l:000f7c d:001d74 EVAL -e:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000f7c d:000f7c TOP

-- Ruby level backtrace information ----------------------------------------
-e:1:in `

'
-e:1:in `new'

-- C level backtrace information -------------------------------------------
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(+0x17ca75) [0x28ca75] vm_dump.c:796
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(+0x526ff) [0x1626ff] error.c:258
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(rb_bug+0x44) [0x163354] error.c:277
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(+0x10ca5c) [0x21ca5c] signal.c:609
[0x80840c]
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(st_lookup+0xe) [0x2244ae] st.c:326
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(rb_hash_lookup2+0x3d) [0x182e6d] hash.c:529
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(rb_hash_lookup+0x2b) [0x182ebb] hash.c:538
/home/adam/.rvm/gems/ruby-1.9.3-p0@rails-3.1/gems/redcarpet-2.0.1/lib/redcarpet.so(+0xb504) [0xf86504] rc_markdown.c:30
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(+0x167ce5) [0x277ce5] vm_insnhelper.c:317
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(+0x175f6f) [0x285f6f] vm_insnhelper.c:404
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(+0x16d273) [0x27d273] insns.def:1015
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(+0x172293) [0x282293] vm.c:1220
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(rb_iseq_eval_main+0xb5) [0x287be5] vm.c:1461
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(+0x560d4) [0x1660d4] eval.c:204
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(ruby_exec_node+0x24) [0x166f44] eval.c:251
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9(ruby_run_node+0x36) [0x168e26] eval.c:244
ruby() [0x8048678]
/lib/libc.so.6(__libc_start_main+0xf3) [0x41ddf413]
ruby() [0x80486a1]

-- Other runtime information -----------------------------------------------

* Loaded script: -e

* Loaded features:

0 enumerator.so
1 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/i686-linux/enc/encdb.so
2 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/i686-linux/enc/trans/transdb.so
3 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/defaults.rb
4 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/i686-linux/rbconfig.rb
5 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/deprecate.rb
6 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/exceptions.rb
7 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
8 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb
9 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/version.rb
10 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/requirement.rb
11 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/platform.rb
12 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb
13 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/path_support.rb
14 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb
15 /home/adam/.rvm/gems/ruby-1.9.3-p0@rails-3.1/gems/redcarpet-2.0.1/lib/redcarpet.so
16 /home/adam/.rvm/gems/ruby-1.9.3-p0@rails-3.1/gems/redcarpet-2.0.1/lib/redcarpet.rb

* Process memory map:

00110000-0032e000 r-xp 00000000 fd:06 10437084 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9.1
0032e000-00333000 rw-p 0021d000 fd:06 10437084 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/libruby.so.1.9.1
00333000-00342000 rw-p 00000000 00:00 0
00808000-00809000 r-xp 00000000 00:00 0 [vdso]
00952000-00954000 r-xp 00000000 fd:06 2523301 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/i686-linux/enc/trans/transdb.so
00954000-00955000 rw-p 00001000 fd:06 2523301 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/i686-linux/enc/trans/transdb.so
00b4b000-00b4d000 r-xp 00000000 fd:06 2523209 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/i686-linux/enc/encdb.so
00b4d000-00b4e000 rw-p 00001000 fd:06 2523209 /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/i686-linux/enc/encdb.so
00f7b000-00f8c000 r-xp 00000000 fd:06 8324001 /home/adam/.rvm/gems/ruby-1.9.3-p0@rails-3.1/gems/redcarpet-2.0.1/lib/redcarpet.so
00f8c000-00f8d000 rw-p 00011000 fd:06 8324001 /home/adam/.rvm/gems/ruby-1.9.3-p0@rails-3.1/gems/redcarpet-2.0.1/lib/redcarpet.so
08048000-08049000 r-xp 00000000 fd:06 1671986 /home/adam/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
08049000-0804a000 rw-p 00000000 fd:06 1671986 /home/adam/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
09c9a000-09f2e000 rw-p 00000000 00:00 0 [heap]
41da5000-41dc2000 r-xp 00000000 fd:00 1184 /lib/ld-2.14.so
41dc2000-41dc3000 r--p 0001d000 fd:00 1184 /lib/ld-2.14.so
41dc3000-41dc4000 rw-p 0001e000 fd:00 1184 /lib/ld-2.14.so
41dc6000-41f4b000 r-xp 00000000 fd:00 1185 /lib/libc-2.14.so
41f4b000-41f4c000 ---p 00185000 fd:00 1185 /lib/libc-2.14.so
41f4c000-41f4e000 r--p 00185000 fd:00 1185 /lib/libc-2.14.so
41f4e000-41f4f000 rw-p 00187000 fd:00 1185 /lib/libc-2.14.so
41f4f000-41f52000 rw-p 00000000 00:00 0
41f54000-41f6a000 r-xp 00000000 fd:00 1307 /lib/libpthread-2.14.so
41f6a000-41f6b000 r--p 00015000 fd:00 1307 /lib/libpthread-2.14.so
41f6b000-41f6c000 rw-p 00016000 fd:00 1307 /lib/libpthread-2.14.so
41f6c000-41f6e000 rw-p 00000000 00:00 0
41f70000-41f73000 r-xp 00000000 fd:00 1321 /lib/libdl-2.14.so
41f73000-41f74000 r--p 00002000 fd:00 1321 /lib/libdl-2.14.so
41f74000-41f75000 rw-p 00003000 fd:00 1321 /lib/libdl-2.14.so
41f77000-41f7e000 r-xp 00000000 fd:00 1308 /lib/librt-2.14.so
41f7e000-41f7f000 r--p 00006000 fd:00 1308 /lib/librt-2.14.so
41f7f000-41f80000 rw-p 00007000 fd:00 1308 /lib/librt-2.14.so
41f82000-41faa000 r-xp 00000000 fd:00 1336 /lib/libm-2.14.so
41faa000-41fab000 r--p 00028000 fd:00 1336 /lib/libm-2.14.so
41fab000-41fac000 rw-p 00029000 fd:00 1336 /lib/libm-2.14.so
4bb8a000-4bb91000 r-xp 00000000 fd:00 4829 /lib/libcrypt-2.14.so
4bb91000-4bb92000 r--p 00007000 fd:00 4829 /lib/libcrypt-2.14.so
4bb92000-4bb93000 rw-p 00008000 fd:00 4829 /lib/libcrypt-2.14.so
4bb93000-4bbba000 rw-p 00000000 00:00 0
4bbbc000-4bc05000 r-xp 00000000 fd:00 4823 /lib/libfreebl3.so
4bc05000-4bc06000 rw-p 00049000 fd:00 4823 /lib/libfreebl3.so
4bc06000-4bc0a000 rw-p 00000000 00:00 0
4ca24000-4ca40000 r-xp 00000000 fd:00 20996 /lib/libgcc_s-4.6.1-20110908.so.1
4ca40000-4ca41000 rw-p 0001b000 fd:00 20996 /lib/libgcc_s-4.6.1-20110908.so.1
b7614000-b7615000 rw-p 00000000 00:00 0
b7615000-b761c000 r--s 00000000 fd:00 134945 /usr/lib/gconv/gconv-modules.cache
b761c000-b761d000 ---p 00000000 00:00 0
b761d000-b76a1000 rw-p 00000000 00:00 0
b76a1000-b78a1000 r--p 00000000 fd:00 147717 /usr/lib/locale/locale-archive
b78a1000-b78a4000 rw-p 00000000 00:00 0
b78c6000-b78c7000 rw-p 00000000 00:00 0
bf9f0000-bfa12000 rw-p 00000000 00:00 0 [stack]

[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

[1] 29427 abort (core dumped) ruby -rredcarpet -
```