tenderlove/nokogiri — Issue #558: Segfault when using Node#<<( attr_node )
Author: Phrogz
Created: 2011-11-01 15:41:30+00:00
State: open

Repro code:

require 'nokogiri'
p Nokogiri::VERSION, RUBY_DESCRIPTION
r = Nokogiri.XML('').root
r << r.at_xpath('@a').remove

Result:

"1.5.0"
"ruby 1.9.2p180 (2011-02-18) [i386-mingw32]"
C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0-x86-mingw32/lib/nokogiri/xml/node.rb:270: [BUG] Segmentation fault
ruby 1.9.2p180 (2011-02-18) [i386-mingw32]

-- control frame ----------
c:0006 p:---- s:0019 b:0019 l:000018 d:000018 CFUNC :add_child_node
c:0005 p:0060 s:0015 b:0015 l:000014 d:000014 METHOD C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0-x86-mingw32/lib/nokogiri/xml/node.rb:270
c:0004 p:0013 s:0011 b:0011 l:000010 d:000010 METHOD C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0-x86-mingw32/lib/nokogiri/xml/node.rb:283
c:0003 p:0088 s:0007 b:0007 l:001e9c d:0009d8 EVAL C:/Users/gkistner.NVIDIA.COM/Desktop/tmp2.rb:4
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001e9c d:001e9c TOP
---------------------------
-- Ruby level backtrace information ----------------------------------------
C:/Users/gkistner.NVIDIA.COM/Desktop/tmp2.rb:4:in `

'
C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0-x86-mingw32/lib/nokogiri/xml/node.rb:283:in `<<'
C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0-x86-mingw32/lib/nokogiri/xml/node.rb:270:in `add_child'
C:/Ruby/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0-x86-mingw32/lib/nokogiri/xml/node.rb:270:in `add_child_node'

[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

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.