ruby-changes:19768
From: yugui <ko1@a...>
Date: Mon, 30 May 2011 13:44:17 +0900 (JST)
Subject: [ruby-changes:19768] yugui:r31813 (ruby_1_9_2): merges a part of r31319 from trunk into ruby_1_9_2.
yugui 2011-05-30 13:44:04 +0900 (Mon, 30 May 2011) New Revision: 31813 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31813 Log: merges a part of r31319 from trunk into ruby_1_9_2. -- * lib/xmlrpc/create.rb (XMLRPC::Create#conv2value): XML-RPC's int is 32bit int, and Fixnum also may be beyond 32bit. Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/lib/xmlrpc/create.rb branches/ruby_1_9_2/test/xmlrpc/test_marshal.rb branches/ruby_1_9_2/version.h Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 31812) +++ ruby_1_9_2/ChangeLog (revision 31813) @@ -1,3 +1,8 @@ +Fri Apr 22 11:49:49 2011 NARUSE, Yui <naruse@r...> + + * lib/xmlrpc/create.rb (XMLRPC::Create#conv2value): + XML-RPC's int is 32bit int, and Fixnum also may be beyond 32bit. + Fri Apr 22 04:16:14 2011 Aaron Patterson <aaron@t...> * ext/psych/parser.c (parse): strings from psych have proper taint Index: ruby_1_9_2/lib/xmlrpc/create.rb =================================================================== --- ruby_1_9_2/lib/xmlrpc/create.rb (revision 31812) +++ ruby_1_9_2/lib/xmlrpc/create.rb (revision 31813) @@ -178,10 +178,8 @@ def conv2value(param) val = case param - when Fixnum - @writer.tag("i4", param.to_s) - - when Bignum + when Fixnum, Bignum + # XML-RPC's int is 32bit int, and Fixnum also may be beyond 32bit if Config::ENABLE_BIGINT @writer.tag("i4", param.to_s) else Index: ruby_1_9_2/version.h =================================================================== --- ruby_1_9_2/version.h (revision 31812) +++ ruby_1_9_2/version.h (revision 31813) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 237 +#define RUBY_PATCHLEVEL 238 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 Index: ruby_1_9_2/test/xmlrpc/test_marshal.rb =================================================================== --- ruby_1_9_2/test/xmlrpc/test_marshal.rb (revision 31812) +++ ruby_1_9_2/test/xmlrpc/test_marshal.rb (revision 31813) @@ -43,7 +43,7 @@ def test_parser_values v1 = [ - 1, -7778, # integers + 1, -7778, -(2**31), 2**31-1, # integers 1.0, 0.0, -333.0, 2343434343.0, # floats false, true, true, false, # booleans "Hallo", "with < and >", "" # strings @@ -81,6 +81,20 @@ # Struct end + def test_parser_invalid_values + values = [ + -1-(2**31), 2**31, + ] + XMLRPC::XMLParser.each_installed_parser do |parser| + m = XMLRPC::Marshal.new(parser) + + values.each do |v| + assert_raise(RuntimeError, "#{v} shouldn't be dumped, but dumped") \ + { m.dump_response(v) } + end + end + end + def test_no_params_tag # bug found by Idan Sofer -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/