From 839ee606876c71d6ca2fadf13ee4d0dbfebbf25c Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 29 Nov 2010 13:55:27 +0000 Subject: [PATCH] * lib/uri/common.rb (URI::WFKV_): get rid of backtrack explosion by nested repeat operators. [ruby-core:33464] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/uri/common.rb | 2 +- test/uri/test_common.rb | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 690efc7471..b49edb6327 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Nov 29 22:55:24 2010 Nobuyoshi Nakada + + * 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 * win32/Makefile.sub (scriptbin.mk): fix generated rules. diff --git a/lib/uri/common.rb b/lib/uri/common.rb index e6f189bdbe..8cd2f2b069 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -807,7 +807,7 @@ module URI end.join('&') end - WFKV_ = '(?:%\h\h|[^%#=;&]+)' # :nodoc: + WFKV_ = '(?:%\h\h|[^%#=;&])' # :nodoc: # Decode URL-encoded form data from given +str+. # diff --git a/test/uri/test_common.rb b/test/uri/test_common.rb index 410f46bd0b..2c0bc79cd5 100644 --- a/test/uri/test_common.rb +++ b/test/uri/test_common.rb @@ -110,6 +110,8 @@ class TestCommon < Test::Unit::TestCase 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