]> source.dussan.org Git - redmine.git/commitdiff
Fixed unsafe call to #casecmp (#20369, #21000).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 15 Oct 2015 18:31:34 +0000 (18:31 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 15 Oct 2015 18:31:34 +0000 (18:31 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@14676 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb
test/unit/helpers/application_helper_test.rb

index 4bf9e15c871d0a2db24166637e61140239b60a51..60aad08a2993045dd5e903ed29984637c65ae7b2 100644 (file)
@@ -609,7 +609,7 @@ module ApplicationHelper
       parsed << text
       if tag
         if closing
-          if tags.last.casecmp(tag) == 0
+          if tags.last && tags.last.casecmp(tag) == 0
             tags.pop
           end
         else
index 27c711ddac78c51e413b2b59da7894ca90b5dc08..883e9d33ea3f0a19e8dba99775a1b59ed5d7e01b 100644 (file)
@@ -994,6 +994,12 @@ EXPECTED
     assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
   end
 
+  def test_unbalanced_closing_pre_tag_should_not_error
+    assert_nothing_raised do
+      textilizable("unbalanced</pre>")
+    end
+  end
+
   def test_syntax_highlight
     raw = <<-RAW
 <pre><code class="ruby">