]> source.dussan.org Git - redmine.git/commitdiff
\f or \v character in Textile markup may cause RegexpError exception (#29756).
authorGo MAEDA <maeda@farend.jp>
Sun, 28 Oct 2018 11:01:54 +0000 (11:01 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 28 Oct 2018 11:01:54 +0000 (11:01 +0000)
Patch by Go MAEDA.

git-svn-id: http://svn.redmine.org/redmine/trunk@17603 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/wiki_formatting/textile/redcloth3.rb
test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb

index 2349a0b84b2ec9eb8c35be5ce355d4f0cd467043..6ffd7c78c4f099701dc8120e87c3355752b351c8 100644 (file)
@@ -1034,7 +1034,7 @@ class RedCloth3 < String
     def flush_left( text )
         indt = 0
         if text =~ /^ /
-            while text !~ /^ {#{indt}}\S/
+            while text !~ /^ {#{indt}}[^ ]/
                 indt += 1
             end unless text.empty?
             if indt.nonzero?
index cc31a4c802404d07959e187082a2b112cca51632..a4c8167d1de7ecd760f0603193c751bf7f5cc224 100644 (file)
@@ -599,6 +599,12 @@ EXPECTED
     assert_equal expected.gsub(%r{[\r\n\t]}, ''), to_html(text).gsub(%r{[\r\n\t]}, '')
   end
 
+  # TODO: Remove this test after migrating to RedCloth 4
+  def test_should_not_crash_with_special_input
+    assert_nothing_raised { to_html(" \f") }
+    assert_nothing_raised { to_html(" \v") }
+  end
+
   private
 
   def assert_html_output(to_test, expect_paragraph = true)