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

prevent possible stack overflow due to recursive syntax support

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 0.9.2
    • Fix Version/s: None
    • Labels:

      Description

      Test.Thrift
      namespace * Thrift.Test
      
      struct Foo {
        1: Bar bar
      }
      
      struct Bar {
        1: Foo foo 
      }
      
      service ThriftTest
      {
        i32 testRecursive(1: Foo foo);
      }
      
      TestClient.cs
      var first = new Foo()
      {
      	Bar = new Bar()
      	{
      		Foo = new Foo()
      		{
      			Bar = new Bar()
      			{
      				Foo = null
      			}
      		}
      	}
      };
      
      Console.Write("testRecursive(tree)");
      Console.WriteLine(" = {0}", client.testRecursive(first));
      
      
      Console.Write("testRecursive(ring)");
      first.Bar.Foo.Bar.Foo = first;  // now let the innermost leaf backpoint to the root node
      Console.WriteLine(" = {0}", client.testRecursive(first));
      
      output
      testRecursive(tree) = 4
      testRecursive(ring)
      Process is terminated due to StackOverflowException.
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jensg Jens Geyer
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: