Bugs item #7529, was opened at 2007-01-02 05:14
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=7529&group_id=494
Category: None
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 3
Submitted By: Nobody (None)
>Assigned to: Charlie Savage (cfis)
Summary: Segfault on parser_context.doc access after XML parse error
Initial Comment:
(libxml-ruby 0.3.9.1
ruby 1.8.5 (2006-08-25) [i686-linux],
Libxml2 2.6.23,
Fedora Core 5 [2.6.17-1.2174_FC5])
If the XML::Parser parser_context.doc is accessed and used following a parse
error, a segfault will arise. This script reproduces this error for me:
#!/usr/local/bin/ruby
require 'xml/libxml'
#adding an error handler prevents the segfault
#XML::Parser.register_error_handler lambda { |*args| }
xp = XML::Parser.file(File.expand_path(
File.join(File.dirname(__FILE__), 'data.html')))
had_err = false
xp.parse rescue had_err = true
if had_err
raise "got doc" if xp.parser_context.doc.root # SEGFAULT
else
raise "didn't error"
end
puts "all ok"
__END__
Outputs:
<<parser errors elided>>
parse_error_doc_bug.rb:13: got doc (RuntimeError)
parse_error_doc_bug.rb:13: [BUG] Segmentation fault
ruby 1.8.5 (2006-08-25) [i686-linux]
Aborted
I think the expected behaviour would be for parser_context.doc to be nil if the
last parse had errors.
----------------------------------------------------------------------
>Comment By: Charlie Savage (cfis)
Date: 2008-07-09 10:14
Message:
This looks like an internal data structure, so access to context.doc has been
removed. Is there anything you need it for.
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=7529&group_id=494
_______________________________________________
libxml-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/libxml-devel