diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-25 07:29:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-25 07:29:50 +0000 |
commit | 682f3a788102113fdb1927e2b42ef7932106acb2 (patch) | |
tree | e9e0403a8d1a41357764f7130c849ab77b806019 /test/uri | |
parent | 2bded596ecece11fe4ba34e851e14d91e2f5d19a (diff) | |
download | ruby-682f3a788102113fdb1927e2b42ef7932106acb2.tar.gz |
uri/common.rb: use negative look-ahead
* lib/uri/common.rb (URI.decode_www_form_component): use negative
look-ahead instead of nested repeat operators, to get rid of
backtrack explosion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/uri')
-rw-r--r-- | test/uri/test_common.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/uri/test_common.rb b/test/uri/test_common.rb index 7808bcdc3c..24a5325522 100644 --- a/test/uri/test_common.rb +++ b/test/uri/test_common.rb @@ -100,6 +100,9 @@ class TestCommon < Test::Unit::TestCase URI.decode_www_form_component("\xE3\x81\x82%E3%81%82".force_encoding("UTF-8"))) assert_raise(ArgumentError){URI.decode_www_form_component("%")} + assert_raise(ArgumentError){URI.decode_www_form_component("%a")} + assert_raise(ArgumentError){URI.decode_www_form_component("x%a_")} + assert_nothing_raised(ArgumentError){URI.decode_www_form_component("x"*(1024*1024))} end def test_encode_www_form |