vmg / rinku

Autolinking. Ruby. Yes, that's pretty much it.
ISC License
599 stars 67 forks source link

Segfault when used in Rails with non-ascii chars #4

Closed nono closed 13 years ago

nono commented 13 years ago

Hi,

it seems that Rinku (1.2.0) doesn't like non-ascii chars when used with Rails (3.0.9). For example, if I try this in the console:

Rinku.auto_link('héhé', :urls)

I got this segfault:

(pry):3: [BUG] Segmentation fault
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]

-- control frame ----------
c:0023 p:---- s:0083 b:0083 l:000082 d:000082 CFUNC  :auto_link
c:0022 p:0019 s:0078 b:0078 l:0012d4 d:000077 EVAL   (pry):3
c:0021 p:---- s:0076 b:0076 l:000075 d:000075 FINISH
c:0020 p:---- s:0074 b:0074 l:000073 d:000073 CFUNC  :eval
c:0019 p:0241 s:0068 b:0067 l:000066 d:000066 METHOD /home/nono/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_instance.rb:226
c:0018 p:0041 s:0060 b:0060 l:000059 d:000059 METHOD /home/nono/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_instance.rb:193
c:0017 p:0012 s:0055 b:0055 l:000039 d:000054 BLOCK  /home/nono/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_instance.rb:178
c:0016 p:---- s:0053 b:0053 l:000052 d:000052 FINISH
c:0015 p:---- s:0051 b:0051 l:000050 d:000050 CFUNC  :loop
c:0014 p:0040 s:0048 b:0048 l:000039 d:000047 BLOCK  /home/nono/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_instance.rb:177
c:0013 p:---- s:0046 b:0046 l:000045 d:000045 FINISH
c:0012 p:---- s:0044 b:0044 l:000043 d:000043 CFUNC  :catch
c:0011 p:0080 s:0040 b:0040 l:000039 d:000039 METHOD /home/nono/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_instance.rb:175
c:0010 p:0157 s:0032 b:0032 l:000031 d:000031 METHOD /home/nono/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_class.rb:105
c:0009 p:0017 s:0027 b:0027 l:000026 d:000026 METHOD /home/nono/dev/linuxfr.org/lib/pry_for_console.rb:7
c:0008 p:0210 s:0024 b:0024 l:000650 d:000650 METHOD /home/nono/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands/console.rb:44
c:0007 p:0019 s:0020 b:0020 l:000019 d:000019 METHOD /home/nono/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands/console.rb:8
c:0006 p:0430 s:0016 b:0016 l:000015 d:000015 TOP    /home/nono/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands.rb:23
c:0005 p:---- s:0012 b:0012 l:000011 d:000011 FINISH
c:0004 p:---- s:0010 b:0010 l:000009 d:000009 CFUNC  :require
c:0003 p:0061 s:0006 b:0006 l:0012d4 d:000adc EVAL   script/rails:6
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0012d4 d:0012d4 TOP   
---------------------------
-- Ruby level backtrace information ----------------------------------------
script/rails:6:in `<main>'
script/rails:6:in `require'
/home/nono/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands.rb:23:in `<top (required)>'
/home/nono/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands/console.rb:8:in `start'
/home/nono/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands/console.rb:44:in `start'
/home/nono/dev/linuxfr.org/lib/pry_for_console.rb:7:in `start'
/home/nono/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_class.rb:105:in `start'
/home/nono/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_instance.rb:175:in `repl'
/home/nono/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_instance.rb:175:in `catch'
/home/nono/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_instance.rb:177:in `block in repl'
/home/nono/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_instance.rb:177:in `loop'
/home/nono/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_instance.rb:178:in `block (2 levels) in repl'
/home/nono/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_instance.rb:193:in `rep'
/home/nono/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_instance.rb:226:in `re'
/home/nono/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.9.1/lib/pry/pry_instance.rb:226:in `eval'
(pry):3:in `<main>'
(pry):3:in `auto_link'

-- C level backtrace information -------------------------------------------
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(rb_vm_bugreport+0x72) [0xb7808ee2]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x53967) [0xb76e2967]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(rb_bug+0x3a) [0xb76e2a5a]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x106f84) [0xb7795f84]
[0xb787e40c]
/home/nono/.rvm/gems/ruby-1.9.2-p180/gems/rinku-1.2.0/lib/rinku.so(+0x27ad) [0xb6ca37ad]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x164208) [0xb77f3208]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x174c0e) [0xb7803c0e]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x169b52) [0xb77f8b52]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x16ef88) [0xb77fdf88]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x16f8ec) [0xb77fe8ec]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(rb_f_eval+0xdc) [0xb77fef0c]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x5a918) [0xb76e9918]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x164208) [0xb77f3208]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x174c0e) [0xb7803c0e]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x169b52) [0xb77f8b52]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x16ef88) [0xb77fdf88]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x17221a) [0xb780121a]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(rb_rescue2+0x169) [0xb76e4f79]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x165505) [0xb77f4505]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x1641ed) [0xb77f31ed]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x174c0e) [0xb7803c0e]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x169b52) [0xb77f8b52]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x16ef88) [0xb77fdf88]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x178943) [0xb7807943]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(rb_catch_obj+0xb7) [0xb77f2d87]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x165386) [0xb77f4386]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x164208) [0xb77f3208]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x174c0e) [0xb7803c0e]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x169b52) [0xb77f8b52]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x16ef88) [0xb77fdf88]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(rb_iseq_eval+0x15b) [0xb77fe53b]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x58e4f) [0xb76e7e4f]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(rb_require_safe+0x602) [0xb76e9562]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(rb_f_require+0x26) [0xb76e9846]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x1641e3) [0xb77f31e3]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x174c0e) [0xb7803c0e]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x169b52) [0xb77f8b52]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x16ef88) [0xb77fdf88]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(rb_iseq_eval_main+0x1f5) [0xb77fe3b5]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x5622a) [0xb76e522a]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(ruby_exec_node+0x25) [0xb76e5265]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(ruby_run_node+0x35) [0xb76e6a75]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/bin/ruby(main+0x68) [0x8048748]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0xb74abe37]
/home/nono/.rvm/rubies/ruby-1.9.2-p180/bin/ruby() [0x8048641]

[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

zsh: abort      rails console
vmg commented 13 years ago

Fixed in 1.2.1. Thanks for spotting this!

nono commented 13 years ago

Wow, that was fast :) Thanks for the fix