summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-30 04:44:04 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-30 04:44:04 +0000
commit43be6769f176e5a15d7876d7fa426de096b672a9 (patch)
treeb2dca19fc3be6656deca50e0893c8ce1b4dd7622
parentdc70f82c34711105a6314a3821a06c3bd2090ccd (diff)
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/xmlrpc/create.rb6
-rw-r--r--test/xmlrpc/test_marshal.rb16
-rw-r--r--version.h2
4 files changed, 23 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 3bae107605..632db447ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Apr 22 11:49:49 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * 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@tenderlovemaking.com>
* ext/psych/parser.c (parse): strings from psych have proper taint
diff --git a/lib/xmlrpc/create.rb b/lib/xmlrpc/create.rb
index 2d38a44b30..a1dc0968f0 100644
--- a/lib/xmlrpc/create.rb
+++ b/lib/xmlrpc/create.rb
@@ -178,10 +178,8 @@ module XMLRPC
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
diff --git a/test/xmlrpc/test_marshal.rb b/test/xmlrpc/test_marshal.rb
index 267b43e2e2..9ddc3e75b4 100644
--- a/test/xmlrpc/test_marshal.rb
+++ b/test/xmlrpc/test_marshal.rb
@@ -43,7 +43,7 @@ class Test_Marshal < Test::Unit::TestCase
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 @@ class Test_Marshal < Test::Unit::TestCase
# 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
diff --git a/version.h b/version.h
index abbfdb13cb..5fa42d6d81 100644
--- a/version.h
+++ b/version.h
@@ -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