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

Go: TSimpleJSONProtocol could panic on WriteMessageEnd without matching WriteMessageBegin

    XMLWordPrintableJSON

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.13.0
    • Fix Version/s: 0.14.0
    • Component/s: Go - Library
    • Labels:
      None

      Description

      I noticed the issue while writing the example loggingMiddleware code in https://github.com/apache/thrift/pull/1992#issuecomment-705903922. The root cause is that we have two context stacks when implementing TSimpleJSONProtocol in go library, but we never check the slice length before the popping/peeking operations, and in certain circumstances (e.g. calling WriteMessageEnd without matching WriteMessageBegin) it would panic with using -1 as the slice index.

      It should return an TProtocolException instead.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                fishywang Yuxuan Wang
                Reporter:
                fishywang Yuxuan Wang
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m