enguer / xmlrpcnet

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

IndexOutOfRangeException Bug inside XML-RPC.NET #65

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I've stumbled (quite painfully) across a bug (or at least a major debugging
inconvenience) in XML-RPC.NET. An IndexOutOfRangeException is thrown 
internally
here:

at CookComputing.XmlRpc.XmlRpcSerializer.DeserializeRequest(XmlDocument 
xdoc,
Type svcType) in F:\Temp\xml-rpc.net.2.4.0\src\XmlRpcSerializer.cs:line 378
at CookComputing.XmlRpc.XmlRpcSerializer.DeserializeRequest(Stream stm, 
Type
svcType) in F:\Temp\xml-rpc.net.2.4.0\src\XmlRpcSerializer.cs:line 259
at CookComputing.XmlRpc.XmlRpcServerProtocol.Invoke(Stream requestStream) 
in
F:\Temp\xml-rpc.net.2.4.0\src\XmlRpcServerProtocol.cs:line 55

and manifests itself as a very unhelpful "Index was outside the bounds of 
the
array." fault message.

To reproduce this you can create a service with this method signature:

[XmlRpcMethod("blogger.getUsersBlogs")]
public UserBlogStruct[] GetUsersBlogs(string username, string password)

and then request at it with this request:

<?xml version="1.0" encoding="utf-8"?>
<methodCall>
<methodName>blogger.getUsersBlogs</methodName>
<params>
<param>
<value>

<string>ffffffabffffffce6dffffff93ffffffac29ffffffc9fffffff826ffffffdefffff
fc9ff\
ffffe43c0b763036ffffffa0fffffff3ffffffa963377716</string>
</value>
</param>
<param>
<value>
<string>myusername</string>
</value>
</param>
<param>
<value>
<string>mypassword</string>
</value>
</param>
</params>
</methodCall>

You've probably already noticed the source of the problem: the request has 
three
parameters but the service method only defines two!

Obviously this is a bug in the service method definition, however, I think
XML-RPC desperately needs to detect this mistake cleanly and report it in 
the
fault message, not just chuck an IndexOutOfRangeException, which is 
completely
unhelpful. To find this trivial service method mistake (on my part) I 
ended up
having to compile XML-RPC in Debug mode and reference that assembly so I 
could
step through the code line by line and find where the weird fault message 
was
coming from! A fault message that just told me that the request asked for 
more
parameters than I have defined in the service method, or even just "method
signature mismatch" would have saved me hours of flailing.

Not being familiar with the source code makes me not want to try and 
submit a
patch; there's a lot going on in the code that I don't understand, yet I 
have a
feeling that someone who knows the code could fix this issue in a jiffy.

Thanks for your attention and for XMP-RPC.NET in the first place!

Original issue reported on code.google.com by ChasC...@gmail.com on 6 Jan 2010 at 8:27

GoogleCodeExporter commented 8 years ago

Original comment by ChasC...@gmail.com on 22 May 2010 at 3:48

GoogleCodeExporter commented 8 years ago
Fixed in revision 119.

Original comment by ChasC...@gmail.com on 23 May 2010 at 2:57