Permalink
Browse files

Strip_tags never ending attribute should not raise a TypeError [#4870

…state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent dd8b741 commit 2002e5877efa40b336b70b707670e734c6389958 @nono nono committed with josevalim Jun 26, 2010
@@ -177,6 +177,7 @@ def parse(parent, line, pos, content, strict=true)
case text
when "\\" then
value << text
+ break if scanner.eos?
value << scanner.getch
when delim
break
@@ -96,6 +96,7 @@ def consume_quoted_regions
while match = @scanner.scan_until(/[\\#{delim}]/)
text << match
break if @scanner.matched == delim
+ break if @scanner.eos?
text << @scanner.getch # skip the escaped character
end
end
@@ -257,6 +257,10 @@ def test_should_not_mangle_urls_with_ampersand
assert_sanitized %{<a href=\"http://www.domain.com?var1=1&amp;var2=2\">my link</a>}
end
+ def test_should_sanitize_neverending_attribute
+ assert_sanitized "<span class=\"\\", "<span class=\"\\\">"
+ end
+
protected
def assert_sanitized(input, expected = nil)
@sanitizer ||= HTML::WhiteListSanitizer.new

0 comments on commit 2002e58

Please sign in to comment.