From b5bf109a599ea733663150e99c09eb44046b41dd Mon Sep 17 00:00:00 2001 From: Hiroya Fujinami Date: Thu, 13 Jun 2024 15:12:32 +0900 Subject: [PATCH] Add a "malformed comment" check for top-level comments (#145) This check was missing. Therefore, `REXML::Document.new("/um, true)[1] ] + md = @source.match(/(.*?)-->/um, true) + if md.nil? + raise REXML::ParseException.new("Unclosed comment", @source) + end + if /--|-\z/.match?(md[1]) + raise REXML::ParseException.new("Malformed comment", @source) + end + return [ :comment, md[1] ] elsif @source.match("DOCTYPE", true) base_error_message = "Malformed DOCTYPE" unless @source.match(/\s+/um, true) -- 2.40.0