Uploaded image for project: 'XML-RPC'
  1. XML-RPC
  2. XMLRPC-98

Serious problem with method selection in ReflectiveXmlRpcHandler

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 3.0b1
    • Fix Version/s: None
    • Component/s: Source
    • Labels:
      None

      Description

      There's a trouble with loop indexes in the code preventing normal selection of methods to execute. Please examine this code:


      for (int i = 0; i < methods.length; i++) {
      MethodData methodData = methods[i];
      TypeConverter[] converters = methodData.typeConverters;
      if (args.length == converters.length) {
      boolean matching = true;
      for (int j = 0; j < args.length; j++) {
      if (!converters[j].isConvertable(args[i]))

      { matching = false; break; }

      }
      if (matching) {
      for (int j = 0; j < args.length; j++)

      { args[i] = converters[i].convert(args[i]); }

      return invoke(instance, methodData.method, args);
      }
      }
      }

      It should be (insignificant parts skipped):


      for (int i = 0; i < methods.length; i++) {
      ...
      if (!converters[j].isConvertable(args[j])) {
      ...
      args[j] = converters[j].convert(args[j]);
      ...
      }

      Please notice the change in indexes:

      • in isConvertable() call it's 'j' as we loop through args
      • in the line with convert() call there are three 'j' instead of three 'i'

      Frankly speaking, such mistakes look very scary. I'm moving our server from xmlrpc-1.2 to 3.0 and this makes me think and think if it's worth the effort even though the version 1.2 has a terrible bug with exception handling and threads leak. Sorry for telling this.

      Anyway, keep up good work and thanks for a good open-source project!

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                spyromus Aleksey Gureev
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: