mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fixed HTML::Tokenizer (used in sanitize helper) didnt handle unclosed CDATA tags (closes #10071) [esad, packagethief]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9111 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
bdd88810c1
commit
c57254d449
3 changed files with 10 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Fixed HTML::Tokenizer (used in sanitize helper) didn't handle unclosed CDATA tags #10071 [esad, packagethief]
|
||||
|
||||
* Improve documentation. [Radar, Jan De Poorter, chuyeow, xaviershay, danger, miloops, Xavier Noria, Sunny Ripert]
|
||||
|
||||
* Fixed that FormHelper#radio_button would produce invalid ids #11298 [harlancrystal]
|
||||
|
|
|
@ -54,7 +54,7 @@ module HTML #:nodoc:
|
|||
tag << (@scanner.scan_until(/--\s*>/) || @scanner.scan_until(/\Z/))
|
||||
elsif @scanner.scan(/!\[CDATA\[/)
|
||||
tag << @scanner.matched
|
||||
tag << @scanner.scan_until(/\]\]>/)
|
||||
tag << (@scanner.scan_until(/\]\]>/) || @scanner.scan_until(/\Z/))
|
||||
elsif @scanner.scan(/!/) # doctype
|
||||
tag << @scanner.matched
|
||||
tag << consume_quoted_regions
|
||||
|
|
|
@ -78,6 +78,13 @@ class TokenizerTest < Test::Unit::TestCase
|
|||
assert_end
|
||||
end
|
||||
|
||||
def test_unterminated_cdata_tag
|
||||
tokenize %{<content:encoded><![CDATA[ neverending...}
|
||||
assert_next %{<content:encoded>}
|
||||
assert_next %{<![CDATA[ neverending...}
|
||||
assert_end
|
||||
end
|
||||
|
||||
def test_less_than_with_space
|
||||
tokenize %{original < hello > world}
|
||||
assert_next %{original }
|
||||
|
|
Loading…
Reference in a new issue