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

Category: General
Group: v0.5
>Status: Closed
Resolution: None
Priority: 3
Submitted By: Saurabh Nanda (saurabhnanda)
>Assigned to: Charlie Savage (cfis)
Summary: Calling parse() twice causes segfault

Initial Comment:
The following snipped of code is guaranteed to segfault:

require 'xml/libxml'
x=XML::Parser.string("<test>something</test>")
doc=x.parse
x.parse

If you run it using ruby on the command line it segfaults immediately, for eg.

$ ruby /tmp/segfault.rb

Or, if you copy paste it in irb, it segfaults as soon as you try to _exit_ irb.


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

>Comment By: Charlie Savage (cfis)
Date: 2008-07-01 02:55

Message:
This must be fixed.

class TC_XML_Parser2 < Test::Unit::TestCase
  def test_double_parse
    parser = XML::Parser.string("<test>something</test>")
    doc = parser.parse
    parser.parse
  end
end

Result:

  1) Error:
test_double_parse(TC_XML_Parser2):
XML::Parser::ParseError: Document didn't parse
    C:\Development\msys\src\rlibxml\test\tc_xml_parser9.rb:8:in `parse'
    C:\Development\msys\src\rlibxml\test\tc_xml_parser9.rb:8:in 
`test_double_parse'

1 tests, 0 assertions, 0 failures, 1 errors
Entity: line 1: parser error : Document is empty
<test>something</test>
                      ^

Program exited with code 1



Seems like reasonable behavior to me.

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

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=17885&group_id=494
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to