Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-370

unset fields in structs in c++ have __isset set to true

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 0.1
    • 0.1
    • C++ - Library
    • None
    • Linux 2.6.27-11 x86_64

    Description

      If you have a struct like:

      struct test_struct {
      1:string test_string
      }

      and then in a c++ client you do:

      test_struct foo;
      client.someFunc(foo)

      then the server will see it's argument (arg) as having arg.__isset.test_string set to true.

      similarly from the client side if expect a return value and do:

      test_struct returnVal;
      client.someFunc(returnVal);

      and the server does not set the returnVal to anything it will still see returnVal.__isset.test_string as true

      in all cases the string is set to the empty string as the constuctor for test_struct sets it, but __isset should not be true.

      Attached (should be) a simple test case. Just untar run "thrift --gen cpp isset.thrift" and then run make. start up the server and run the client to see the output.

      Attachments

        1. issetTest.tar.gz
          1 kB
          Nick Lanham

        Activity

          People

            Unassigned Unassigned
            nick1 Nick Lanham
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: