Actions
Bug #13636
closedREXML::Document.parse_stream doesn't handle when closing tag not provided
Description
I've tried to use REXML for parsing but got unexpected behavior:
Here is example:
require 'rexml/document'
require 'rexml/streamlistener'
class Handler include REXML::StreamListener end
xml1 = StringIO.new("<body><item>test</item></body>")
xml2 = StringIO.new("<body><item>test</body>")
xml3 = StringIO.new("<body><item>test</item>")
handler = Handler.new
REXML::Document.parse_stream(xml1, handler) # => nil
REXML::Document.parse_stream(xml2, handler) # => REXML::ParseException: Missing end tag for 'item' (got "body")
REXML::Document.parse_stream(xml3, handler) # => nil
Actualy XML: "
test" is broken so it's expected to get:REXML::ParseException.new( "Missing end tag for body")
I can't rely on REXML parse since I'm not getting exception when XML data structure not valid.
Updated by fanantoxa (Anton Sivakov) over 7 years ago
Expected to get exception for xml3 example
Updated by hsbt (Hiroshi SHIBATA) over 7 years ago
- Status changed from Open to Assigned
- Assignee set to kou (Kouhei Sutou)
- Target version set to 2.5
Updated by kou (Kouhei Sutou) over 7 years ago
- Status changed from Assigned to Closed
Applied in changeset trunk|r59033.
rexml: add close tag check on end of document to StreamParser
[ruby-core:81593] [Bug #13636]
Reported by Anton Sivakov. Thanks!!!
Updated by kou (Kouhei Sutou) over 7 years ago
Thanks for your report.
I've added a validation on end of document.
Updated by usa (Usaku NAKAMURA) over 7 years ago
- Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN to 2.2: WONTFIX, 2.3: REQUIRED, 2.4: REQUIRED
Updated by usa (Usaku NAKAMURA) over 7 years ago
- Backport changed from 2.2: WONTFIX, 2.3: REQUIRED, 2.4: REQUIRED to 2.2: WONTFIX, 2.3: DONE, 2.4: REQUIRED
ruby_2_3 r59239 merged revision(s) 59033,59034.
Updated by nagachika (Tomoyuki Chikanaga) over 7 years ago
- Backport changed from 2.2: WONTFIX, 2.3: DONE, 2.4: REQUIRED to 2.2: WONTFIX, 2.3: DONE, 2.4: DONE
ruby_2_4 r59399 merged revision(s) 59033,59034.
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0