[libxml-devel] [ libxml-Bugs-22909 ] LibXML::XML::XPath::Object segfault (null pointer) on x86-64

noreply at rubyforge.org noreply at rubyforge.org
Thu Nov 20 14:47:29 EST 2008


Bugs item #22909, was opened at 2008-11-20 19:47
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=22909&group_id=494

Category: General
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Bradley Buda (bradleybuda)
Assigned to: Nobody (None)
Summary: LibXML::XML::XPath::Object segfault (null pointer) on x86-64

Initial Comment:
This script results in a ruby "[BUG] Segmentation fault" on a 64-bit machine, but works on a 32-bit machine:

----

#!/usr/bin/ruby

require 'rubygems'
require 'libxml'

x = LibXML::XML::Parser.string("<root />").parse
x.find("/root") # if you comment out this line, script will NOT segfault
x.find("/root").length  # segfault occurs here

----

valgrind and gdb agree on this stack trace:
#0  0x00002aaaaca47bc7 in ruby_xml_xpath_object_empty_q (self=46912524542400) at ruby_xml_xpath_object.c:174
#1  0x00002aaaaca47c59 in ruby_xml_xpath_object_length (self=46912524542400) at ruby_xml_xpath_object.c:242
#2  0x00002aaaaacff48f in ?? () from /usr/lib/libruby1.8.so.1.8
#3  0x00002aaaaacff7b8 in ?? () from /usr/lib/libruby1.8.so.1.8
#4  0x00002aaaaad055b7 in ?? () from /usr/lib/libruby1.8.so.1.8
#5  0x00002aaaaad0dbbb in ?? () from /usr/lib/libruby1.8.so.1.8
#6  0x00002aaaaad0dc05 in ruby_exec () from /usr/lib/libruby1.8.so.1.8
#7  0x00002aaaaad0dc30 in ruby_run () from /usr/lib/libruby1.8.so.1.8
#8  0x0000000000400883 in main ()

Unfortunately I don't know enough about the Ruby C API to understand what's going wrong here.  My environment:

(note that this is a Xen node on Amazon EC2)
$ uname -a
Linux ...compute-1.amazonaws.com 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:34:28 EST 2008 x86_64 GNU/Linux

$ lsb_release  -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 8.04.1
Release:        8.04
Codename:       hardy

$ ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [x86_64-linux]

$ gem list --local libxml-ruby

*** LOCAL GEMS ***

libxml-ruby (0.9.2)

$ aptitude show libxml2-dev
Package: libxml2-dev
State: installed
Automatically installed: yes
Version: 2.6.31.dfsg-2ubuntu1.3
...

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=22909&group_id=494


More information about the libxml-devel mailing list