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

Thrift Node.js library crashes app

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 0.10.0
    • Fix Version/s: None
    • Component/s: Node.js - Library
    • Labels:
      None

      Description

      Create TBufferedTransport by using its receiver funciton. and using TCompactProtocol to communicate. But this object lack of `rstack` and `rpos`. It make app crash.

      details:

        struct CliRoomData
        {
      	10: i32 roomId
      	20: string roomName
      	30: i32 masterUserId
      	40: map<i32, CliRoomUserData> mapUserData			// key: user id		value: CliRoomUserData
      	50: map<i32, CliRoomLevelData> mapLevelData			// key: level id	value: CliRoomLevelData
      	60: optional string groupId
        }
      
      

      generated code which crashes the app:

      // input haven't property `rstack` and `rpos`
      if (input.rstack.length > input.rpos[input.rpos.length -1] + 1) { 
          input.rstack.pop();
      }
      

      code about the crash

        const entity = new Protocols[className]() // create the thrift object to read from protocol
          return new Promise((resolve, reject) => {
              const receiver = thrift.TBufferedTransport.receiver((reader) => { // create buffered using library
                  const protocol = new thrift.TCompactProtocol(reader)
                  entity.read(protocol) // crash the app
                  resolve(entity)
              })
              receiver(payload)
          })
      
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dinfer TianYI Wen
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: