ruby-changes:17959
From: nobu <ko1@a...>
Date: Mon, 29 Nov 2010 23:03:42 +0900 (JST)
Subject: [ruby-changes:17959] Ruby:r29976 (trunk): * lib/uri/common.rb (URI::WFKV_): get rid of backtrack explosion
nobu 2010-11-29 22:55:27 +0900 (Mon, 29 Nov 2010) New Revision: 29976 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29976 Log: * lib/uri/common.rb (URI::WFKV_): get rid of backtrack explosion by nested repeat operators. [ruby-core:33464] Modified files: trunk/ChangeLog trunk/lib/uri/common.rb trunk/test/uri/test_common.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 29975) +++ ChangeLog (revision 29976) @@ -1,3 +1,8 @@ +Mon Nov 29 22:55:24 2010 Nobuyoshi Nakada <nobu@r...> + + * lib/uri/common.rb (URI::WFKV_): get rid of backtrack explosion + by nested repeat operators. [ruby-core:33464] + Mon Nov 29 22:53:13 2010 Nobuyoshi Nakada <nobu@r...> * win32/Makefile.sub (scriptbin.mk): fix generated rules. Index: lib/uri/common.rb =================================================================== --- lib/uri/common.rb (revision 29975) +++ lib/uri/common.rb (revision 29976) @@ -807,7 +807,7 @@ end.join('&') end - WFKV_ = '(?:%\h\h|[^%#=;&]+)' # :nodoc: + WFKV_ = '(?:%\h\h|[^%#=;&])' # :nodoc: # Decode URL-encoded form data from given +str+. # Index: test/uri/test_common.rb =================================================================== --- test/uri/test_common.rb (revision 29975) +++ test/uri/test_common.rb (revision 29976) @@ -110,6 +110,8 @@ assert_raise(ArgumentError){URI.decode_www_form("a=1&%=2")} assert_raise(ArgumentError){URI.decode_www_form("a=1&b=%")} assert_raise(ArgumentError){URI.decode_www_form("a&b")} + bug4098 = '[ruby-core:33464]' + assert_raise(ArgumentError, bug4098){URI.decode_www_form("a=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&b")} end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/