tukarambande / xmlrpcnet

Automatically exported from code.google.com/p/xmlrpcnet
0 stars 0 forks source link

Check of ParamArrayAttribute causes crash #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
A call to this kind of XmlRpcMethod:
 [XmlRpcMethod]
 public object Method2(object arg0, params object[] args)

Problem:
This method caused application crash under Mono/Linux but not MS.NET/Windows.

Please consider this patch:

@@ -157,7 +157,8 @@
               if (i >= pis.Length)
                 throw new XmlRpcInvalidParametersException("Number of request "
                   + "parameters greater than number of proxy method parameters.");
-              if (Attribute.IsDefined(pis[i], typeof(ParamArrayAttribute)))
+              else if (i == pis.Length - 1 &&
+                Attribute.IsDefined(pis[i], typeof(ParamArrayAttribute)))
               {
                 Array ary = (Array)request.args[i];
                 foreach (object o in ary)

Explanation:
This looks like more of a Mono problem instead of a XML-RPC.NET problem but I 
think at least the check of ParamArrayAttribute on every 
parameter is unnecessary as the compiler only allows the "params" keyword to be 
applied to the last one.

Original issue reported on code.google.com by Dennis84...@gmail.com on 27 Oct 2008 at 3:25

GoogleCodeExporter commented 8 years ago
The patch and test was based on the latest release: 2.3.2

Original comment by Dennis84...@gmail.com on 27 Oct 2008 at 3:27

GoogleCodeExporter commented 8 years ago
Fixed in revision 67.

Original comment by ChasC...@gmail.com on 1 Nov 2008 at 7:58

GoogleCodeExporter commented 8 years ago

Original comment by ChasC...@gmail.com on 7 Dec 2008 at 10:07